mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 22:25:44 +00:00

PR-URL: https://github.com/nodejs/node/pull/15454 Ref: https://github.com/nodejs/node/pull/14387 Ref: https://github.com/nodejs/node/pull/14722 Ref: https://github.com/nodejs/node/issues/14717 Ref: https://github.com/nodejs/node/issues/15448 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
26 lines
789 B
JavaScript
26 lines
789 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const async_hooks = require('async_hooks');
|
|
const spawnSync = require('child_process').spawnSync;
|
|
|
|
// disabling this way will just decrement the kCheck counter. It won't actually
|
|
// disable the checks, because they were enabled with the flag.
|
|
common.revert_force_async_hooks_checks();
|
|
|
|
switch (process.argv[2]) {
|
|
case 'test_invalid_async_id':
|
|
async_hooks.emitInit();
|
|
return;
|
|
}
|
|
assert.ok(!process.argv[2]);
|
|
|
|
|
|
const c1 = spawnSync(process.execPath, [
|
|
'--force-async-hooks-checks', __filename, 'test_invalid_async_id'
|
|
]);
|
|
assert.strictEqual(
|
|
c1.stderr.toString().split(/[\r\n]+/g)[0],
|
|
'RangeError [ERR_INVALID_ASYNC_ID]: Invalid asyncId value: undefined');
|
|
assert.strictEqual(c1.status, 1);
|