Skip to content

Commit

Permalink
test: move from electron-download to @electron/get (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 committed Aug 1, 2023
1 parent d2029f1 commit 9c7bce8
Show file tree
Hide file tree
Showing 4 changed files with 332 additions and 511 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
/node_modules
/build
*.cache
*.swp
npm-debug.log
bin
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -19,7 +19,7 @@
"test": "mocha test && standard"
},
"devDependencies": {
"electron-download": "^3.0.1",
"@electron/get": "^2.0.2",
"extract-zip": "^1.5.0",
"mocha": "^10.1.0",
"shx": "^0.3.3",
Expand Down
34 changes: 19 additions & 15 deletions test/minidump-test.js
Expand Up @@ -2,7 +2,7 @@ const assert = require('assert')
const path = require('path')

const minidump = require('..')
const electronDownload = require('electron-download')
const { download, downloadArtifact } = require('@electron/get')
const extractZip = require('extract-zip')
const temp = require('temp').track()

Expand Down Expand Up @@ -141,14 +141,12 @@ describe('minidump', function () {
})

function downloadElectron (callback) {
electronDownload({
version: '1.4.3',
arch: 'x64',
platform: process.platform,
quiet: true
}, function (error, zipPath) {
if (error) return callback(error)

download('1.4.3', {
cacheRoot: path.resolve(__dirname, '.cache'),
downloadOptions: {
quiet: true
}
}).then((zipPath) => {
const electronPath = temp.mkdirSync('node-minidump-')
extractZip(zipPath, { dir: electronPath }, function (error) {
if (error) return callback(error)
Expand All @@ -159,23 +157,29 @@ function downloadElectron (callback) {
callback(null, path.join(electronPath, 'electron'))
}
})
}).catch((error) => {
callback(error)
})
}

function downloadElectronSymbols (platform, callback) {
electronDownload({
downloadArtifact({
cacheRoot: path.resolve(__dirname, '.cache'),
version: '1.4.3', // Dumps were generated with Electron 1.4.3 x64
arch: 'x64',
platform,
symbols: true,
quiet: true
}, function (error, zipPath) {
if (error) return callback(error)

artifactName: 'electron',
artifactSuffix: 'symbols',
downloadOptions: {
quiet: true
}
}).then((zipPath) => {
const symbolsPath = temp.mkdirSync('node-minidump-')
extractZip(zipPath, { dir: symbolsPath }, function (error) {
if (error) return callback(error)
callback(null, path.join(symbolsPath, 'electron.breakpad.syms'))
})
}).catch((error) => {
callback(error)
})
}

0 comments on commit 9c7bce8

Please sign in to comment.