node/test/sequential/test-inspector-async-hook-teardown-at-debug-end.js
Andreas Madsen 7c079d1261
async_hooks: skip runtime checks when disabled
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>
2017-10-19 12:45:21 +02:00

23 lines
631 B
JavaScript

'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
common.skipIf32Bits();
const spawn = require('child_process').spawn;
const script = `
const assert = require('assert');
const async_wrap = process.binding('async_wrap');
const { kTotals } = async_wrap.constants;
assert.strictEqual(async_wrap.async_hook_fields[kTotals], 4);
process._debugEnd();
assert.strictEqual(async_wrap.async_hook_fields[kTotals], 0);
`;
const args = ['--inspect', '-e', script];
const child = spawn(process.execPath, args, { stdio: 'inherit' });
child.on('exit', (code, signal) => {
process.exit(code || signal);
});