test: ensure nextTick is not scheduled in exit
Previously our tests did not check this codepath as seen at coverage.nodejs.org PR-URL: https://github.com/nodejs/node/pull/9555 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
parent
9e698bd6db
commit
f65a48fc8f
14
test/parallel/test-next-tick-when-exiting.js
Normal file
14
test/parallel/test-next-tick-when-exiting.js
Normal file
@ -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();
|
Loading…
x
Reference in New Issue
Block a user