0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
nodejs/test/sequential/test-inspector-enabled.js
Benjamin 616fac9169 lib: make coverage work for Node.js
PR-URL: https://github.com/nodejs/node/pull/23941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
2018-11-03 18:35:04 -07:00

30 lines
691 B
JavaScript

'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
const spawn = require('child_process').spawn;
const script = `
const assert = require('assert');
const inspector = process.binding('inspector');
assert(
!!inspector.isEnabled(),
'inspector.isEnabled() should be true when run with --inspect');
process._debugEnd();
assert(
!inspector.isEnabled(),
'inspector.isEnabled() should be false after _debugEnd()');
`;
const args = ['--inspect', '-e', script];
const child = spawn(process.execPath, args, {
stdio: 'inherit',
env: { ...process.env, NODE_V8_COVERAGE: '' }
});
child.on('exit', (code, signal) => {
process.exit(code || signal);
});