node/test/parallel/test-inspector-no-crash-ws-after-bindings.js
Guy Bedford e7ff00d0c5 inspector: --inspect-brk for es modules
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>
2018-01-22 18:39:21 +02:00

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();