mirror of
https://github.com/nodejs/node.git
synced 2025-05-11 17:55:31 +00:00

Reworked rebase of PR #17360 with feedback PR-URL: https://github.com/nodejs/node/pull/18194 Fixes: https://github.com/nodejs/node/issues/17340 Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: James M Snell <jasnell@gmail.com>
32 lines
932 B
JavaScript
32 lines
932 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
common.crashOnUnhandledRejection();
|
|
const { NodeInstance } = require('../common/inspector-helper.js');
|
|
const assert = require('assert');
|
|
|
|
const expected = 'Can connect now!';
|
|
|
|
const script = `
|
|
'use strict';
|
|
const { Session } = require('inspector');
|
|
|
|
const s = new Session();
|
|
s.connect();
|
|
console.error('${expected}');
|
|
process.stdin.on('data', () => process.exit(0));
|
|
`;
|
|
|
|
async function runTests() {
|
|
const instance = new NodeInstance(['--inspect=0', '--expose-internals'],
|
|
script);
|
|
while (await instance.nextStderrString() !== expected);
|
|
assert.strictEqual(400, await instance.expectConnectionDeclined());
|
|
instance.write('Stop!\n');
|
|
assert.deepStrictEqual({ exitCode: 0, signal: null },
|
|
await instance.expectShutdown());
|
|
}
|
|
|
|
runTests();
|