test: show actual error in next-tick-when-exiting

On process exit if some assertion error occurs value of
`process._exiting` was hidden, this fix will show the actual
error message with value.

PR-URL: https://github.com/nodejs/node/pull/20956
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Shailesh Shekhawat 2018-05-25 11:00:53 +08:00 committed by Anatoli Papirovski
parent a69a29da10
commit 8055bdbbc9
No known key found for this signature in database
GPG Key ID: 614E2E1ABEB4B2C0

View File

@ -1,14 +1,14 @@
'use strict'; 'use strict';
require('../common'); const common = require('../common');
const assert = require('assert'); const assert = require('assert');
process.on('exit', () => { process.on('exit', () => {
assert.strictEqual(process._exiting, true, 'process._exiting was not set!'); assert.strictEqual(process._exiting, true);
process.nextTick(() => { process.nextTick(
assert.fail('process is exiting, should not be called.'); common.mustNotCall('process is exiting, should not be called')
}); );
}); });
process.exit(); process.exit();