diff --git a/test/parallel/test-next-tick-when-exiting.js b/test/parallel/test-next-tick-when-exiting.js new file mode 100644 index 00000000000000..1bb4c914d01869 --- /dev/null +++ b/test/parallel/test-next-tick-when-exiting.js @@ -0,0 +1,14 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); + +process.on('exit', () => { + assert.strictEqual(process._exiting, true, 'process._exiting was not set!'); + + process.nextTick(() => { + common.fail('process is exiting, should not be called.'); + }); +}); + +process.exit();