-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: print arbitrary javascript exception value in node report
- Loading branch information
1 parent
3dee233
commit 68d2012
Showing
5 changed files
with
97 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Flags: --report-uncaught-exception | ||
'use strict'; | ||
// Test producing a report on uncaught exception. | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const helper = require('../common/report'); | ||
const tmpdir = require('../common/tmpdir'); | ||
|
||
const exception = 1; | ||
|
||
tmpdir.refresh(); | ||
process.report.directory = tmpdir.path; | ||
|
||
process.on('uncaughtException', common.mustCall((err) => { | ||
assert.strictEqual(err, exception); | ||
const reports = helper.findReports(process.pid, tmpdir.path); | ||
assert.strictEqual(reports.length, 1); | ||
console.log(reports[0]); | ||
helper.validate(reports[0], [ | ||
['javascriptStack.message', `${exception}`], | ||
]); | ||
})); | ||
|
||
throw exception; |
24 changes: 24 additions & 0 deletions
24
test/report/test-report-uncaught-exception-unable-tostring.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Flags: --report-uncaught-exception | ||
'use strict'; | ||
// Test producing a report on uncaught exception. | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const helper = require('../common/report'); | ||
const tmpdir = require('../common/tmpdir'); | ||
|
||
const exception = Symbol('foobar'); | ||
|
||
tmpdir.refresh(); | ||
process.report.directory = tmpdir.path; | ||
|
||
process.on('uncaughtException', common.mustCall((err) => { | ||
assert.strictEqual(err, exception); | ||
const reports = helper.findReports(process.pid, tmpdir.path); | ||
assert.strictEqual(reports.length, 1); | ||
console.log(reports[0]); | ||
helper.validate(reports[0], [ | ||
['javascriptStack.message', "Symbol('foobar')"], | ||
]); | ||
})); | ||
|
||
throw exception; |