mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 12:10:08 +01:00
d6e626d54c
PR-URL: https://github.com/nodejs/node/pull/44197 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Michaël Zasso <targos@protonmail.com>
28 lines
773 B
JavaScript
28 lines
773 B
JavaScript
import { spawnPromisified } from '../common/index.mjs';
|
|
import assert from 'node:assert';
|
|
import { execPath } from 'node:process';
|
|
import { describe, it } from 'node:test';
|
|
|
|
|
|
describe('--trace-uncaught', () => {
|
|
it('prints a trace on process exit for uncaught errors', async () => {
|
|
const { code, signal, stderr } = await spawnPromisified(execPath, [
|
|
'--trace-uncaught',
|
|
'--eval',
|
|
`throw {
|
|
get stack() {
|
|
throw new Error('weird throw but ok');
|
|
},
|
|
get name() {
|
|
throw new Error('weird throw but ok');
|
|
},
|
|
};`,
|
|
]);
|
|
|
|
assert.match(stderr, /^Thrown at:$/m);
|
|
assert.match(stderr, /^ {4}at \[eval\]:1:1$/m);
|
|
assert.strictEqual(code, 1);
|
|
assert.strictEqual(signal, null);
|
|
});
|
|
});
|