Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 517e715

Browse filesBrowse files
cjihrigFishrock123
authored andcommitted
test: add abort test for backtrace validation
This commit adds a test that validates backtraces which are printed on fatal errors. PR-URL: #6734 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent c96d701 commit 517e715
Copy full SHA for 517e715

File tree

Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed
Open diff view settings
Collapse file

‎test/abort/test-abort-backtrace.js‎

Copy file name to clipboard
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const cp = require('child_process');
5+
6+
if (common.isWindows) {
7+
common.skip('Backtraces unimplemented on Windows.');
8+
return;
9+
}
10+
11+
if (process.argv[2] === 'child') {
12+
process.abort();
13+
} else {
14+
const child = cp.spawnSync(`${process.execPath}`, [`${__filename}`, 'child']);
15+
const frames =
16+
child.stderr.toString().trimRight().split('\n').map((s) => s.trim());
17+
18+
assert.strictEqual(child.stdout.toString(), '');
19+
assert.ok(frames.length > 0);
20+
// All frames should start with a frame number.
21+
assert.ok(frames.every((frame, index) => frame.startsWith(`${index + 1}:`)));
22+
// At least some of the frames should include the binary name.
23+
assert.ok(frames.some((frame) => frame.includes(`[${process.execPath}]`)));
24+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.