2020-10-03 23:29:41 +02:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
2025-01-22 14:19:38 -08:00
|
|
|
const { isMainThread } = require('worker_threads');
|
|
|
|
|
|
|
|
if (!isMainThread) {
|
|
|
|
common.skip('This test only works on a main thread');
|
|
|
|
}
|
2020-10-03 23:29:41 +02:00
|
|
|
|
|
|
|
// Test that 'exit' is emitted if 'beforeExit' throws.
|
|
|
|
|
|
|
|
process.on('exit', common.mustCall(() => {
|
|
|
|
process.exitCode = 0;
|
|
|
|
}));
|
|
|
|
process.on('beforeExit', common.mustCall(() => {
|
|
|
|
throw new Error();
|
|
|
|
}));
|