1import { spawnPromisified } from '../common/index.mjs'; 2import assert from 'node:assert'; 3import { execPath } from 'node:process'; 4import { describe, it } from 'node:test'; 5 6 7describe('--trace-uncaught', () => { 8 it('prints a trace on process exit for uncaught errors', async () => { 9 for (const value of [null, undefined]) { 10 const { code, signal, stderr } = await spawnPromisified(execPath, [ 11 '--trace-uncaught', 12 '--eval', 13 `throw ${value};`, 14 ]); 15 assert.match(stderr, /^Thrown at:$/m); 16 assert.match(stderr, /^ {4}at \[eval\]:1:1$/m); 17 assert.strictEqual(code, 1); 18 assert.strictEqual(signal, null); 19 } 20 }); 21}); 22