Skip to content

Commit e4b1454

Browse files
committed
Add initial dumpSymbol test
1 parent dddeb63 commit e4b1454

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

test/minidump-test.js

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ describe('minidump', function () {
1919
minidump.walkStack(dumpPath, symbolsPath, function (error, report) {
2020
if (error) return done(error)
2121

22-
report = report.toString()
22+
assert.equal(Buffer.isBuffer(report), true)
2323
assert.notEqual(report.length, 0)
24+
25+
report = report.toString()
2426
assert.notEqual(report.indexOf('Electron Framework!atom::(anonymous namespace)::Crash() [atom_bindings.cc : 27 + 0x0]'), -1)
2527
done()
2628
})
@@ -37,17 +39,53 @@ describe('minidump', function () {
3739
minidump.walkStack(dumpPath, symbolsPath, function (error, report) {
3840
if (error) return done(error)
3941

40-
report = report.toString()
42+
assert.equal(Buffer.isBuffer(report), true)
4143
assert.notEqual(report.length, 0)
44+
45+
report = report.toString()
4246
assert.notEqual(report.indexOf('electron.exe!atom::`anonymous namespace\'::Crash [atom_bindings.cc : 27 + 0x0]'), -1)
4347
done()
4448
})
4549
})
4650
})
4751
})
4852
})
53+
54+
describe('dumpSymbol()', function () {
55+
it('calls back with a minidump', function (done) {
56+
if (process.platform !== 'darwin') return this.skip()
57+
58+
downloadElectron(function (error, binaryPath) {
59+
if (error) return done(error)
60+
minidump.dumpSymbol(binaryPath, function (error, minidump) {
61+
if (error) return done(error)
62+
63+
assert.equal(Buffer.isBuffer(minidump), true)
64+
assert.notEqual(minidump.length, 0)
65+
done()
66+
})
67+
})
68+
})
69+
})
4970
})
5071

72+
var downloadElectron = function (callback) {
73+
electronDownload({
74+
version: '1.4.3',
75+
arch: 'x64',
76+
platform: 'darwin',
77+
quiet: true
78+
}, function (error, zipPath) {
79+
if (error) return callback(error)
80+
81+
var electronPath = temp.mkdirSync('node-minidump-')
82+
extractZip(zipPath, {dir: electronPath}, function (error) {
83+
if (error) return callback(error)
84+
callback(null, path.join(electronPath, 'Electron.app', 'Contents', 'MacOS', 'Electron'))
85+
})
86+
})
87+
}
88+
5189
var downloadElectronSymbols = function (platform, callback) {
5290
electronDownload({
5391
version: '1.4.3', // Dumps were generated with Electron 1.4.3 x64

0 commit comments

Comments
 (0)