Skip to content

Commit a1295b2

Browse files
committed
Call walkStack with symbols paths
1 parent 2c98357 commit a1295b2

File tree

1 file changed

+38
-34
lines changed

1 file changed

+38
-34
lines changed

test/minidump-test.js

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,62 @@ var electronDownload = require('electron-download')
66
var extractZip = require('extract-zip')
77
var temp = require('temp').track()
88

9-
var downloadElectronSymbols = function (platform, callback) {
10-
var symbolsPath = temp.mkdirSync('node-minidump-')
11-
12-
electronDownload({
13-
version: '1.4.3',
14-
platform: platform,
15-
symbols: true,
16-
quiet: true
17-
}, function (error, zipPath) {
18-
if (error) return callback(error)
19-
extractZip(zipPath, {dir: symbolsPath}, function (error) {
20-
if (error) return callback(error)
21-
minidump.addSymbolPath(path.join(symbolsPath, 'electron.breakpad.syms'))
22-
callback()
23-
})
24-
})
25-
}
26-
279
describe('minidump', function () {
2810
this.timeout(60000)
2911

3012
describe('walkStack()', function () {
3113
describe('macOS dump', function () {
32-
before(function (done) {
33-
downloadElectronSymbols('darwin', done)
34-
})
35-
3614
it('calls back with a report', function (done) {
37-
minidump.walkStack(path.join(__dirname, 'fixtures', 'mac.dmp'), function (error, report) {
15+
downloadElectronSymbols('darwin', function (error, symbolsPath) {
3816
if (error) return done(error)
3917

40-
report = report.toString()
41-
assert.notEqual(report.indexOf('Electron Framework!atom::(anonymous namespace)::Crash() [atom_bindings.cc : 27 + 0x0]'), -1)
42-
done()
18+
var dumpPath = path.join(__dirname, 'fixtures', 'mac.dmp')
19+
minidump.walkStack(dumpPath, symbolsPath, function (error, report) {
20+
if (error) return done(error)
21+
22+
report = report.toString()
23+
assert.notEqual(report.length, 0)
24+
assert.notEqual(report.indexOf('Electron Framework!atom::(anonymous namespace)::Crash() [atom_bindings.cc : 27 + 0x0]'), -1)
25+
done()
26+
})
4327
})
28+
4429
})
4530
})
4631

4732
describe('Windows dump', function () {
48-
before(function (done) {
49-
downloadElectronSymbols('win32', done)
50-
})
51-
5233
it('calls back with a report', function (done) {
53-
minidump.walkStack(path.join(__dirname, 'fixtures', 'windows.dmp'), function (error, report) {
34+
downloadElectronSymbols('win32', function (error, symbolsPath) {
5435
if (error) return done(error)
5536

56-
report = report.toString()
57-
assert.notEqual(report.indexOf('electron.exe!atom::`anonymous namespace\'::Crash [atom_bindings.cc : 27 + 0x0]'), -1)
58-
done()
37+
var dumpPath = path.join(__dirname, 'fixtures', 'windows.dmp')
38+
minidump.walkStack(dumpPath, symbolsPath, function (error, report) {
39+
if (error) return done(error)
40+
41+
report = report.toString()
42+
assert.notEqual(report.length, 0)
43+
assert.notEqual(report.indexOf('electron.exe!atom::`anonymous namespace\'::Crash [atom_bindings.cc : 27 + 0x0]'), -1)
44+
done()
45+
})
5946
})
6047
})
6148
})
6249
})
6350
})
51+
52+
var downloadElectronSymbols = function (platform, callback) {
53+
var symbolsPath = temp.mkdirSync('node-minidump-')
54+
55+
electronDownload({
56+
version: '1.4.3',
57+
platform: platform,
58+
symbols: true,
59+
quiet: true
60+
}, function (error, zipPath) {
61+
if (error) return callback(error)
62+
extractZip(zipPath, {dir: symbolsPath}, function (error) {
63+
if (error) return callback(error)
64+
callback(null, path.join(symbolsPath, 'electron.breakpad.syms'))
65+
})
66+
})
67+
}

0 commit comments

Comments
 (0)