From ccc6e75bea5b3d6e130f1897a9b3723d91124fa6 Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Fri, 11 Nov 2016 15:28:18 -0500 Subject: [PATCH] test: ensure nextTick is not scheduled in exit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Luigi Pinca Reviewed-By: Michaƫl Zasso --- test/parallel/test-next-tick-when-exiting.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/parallel/test-next-tick-when-exiting.js 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();