node/test/parallel/test-process-beforeexit-throw-exit.js
Anna Henningsen 278d38f4cf
src: add maybe versions of EmitExit and EmitBeforeExit
This addresses a TODO comment, and removes invalid `.ToLocalChecked()`
calls from our code base.

PR-URL: https://github.com/nodejs/node/pull/35486
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-10-11 02:20:53 +02:00

13 lines
278 B
JavaScript

'use strict';
const common = require('../common');
common.skipIfWorker();
// Test that 'exit' is emitted if 'beforeExit' throws.
process.on('exit', common.mustCall(() => {
process.exitCode = 0;
}));
process.on('beforeExit', common.mustCall(() => {
throw new Error();
}));