2021-04-08 23:55:45 -07:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
|
|
|
|
const fixtures = require('../common/fixtures');
|
2021-05-03 21:58:42 -07:00
|
|
|
const startCLI = require('../common/debugger');
|
2021-04-08 23:55:45 -07:00
|
|
|
|
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
// Random port with --inspect-port=0.
|
2022-09-16 17:53:18 -04:00
|
|
|
const script = fixtures.path('debugger', 'three-lines.js');
|
2021-04-08 23:55:45 -07:00
|
|
|
|
2022-09-16 17:53:18 -04:00
|
|
|
const cli = startCLI(['--inspect-port=0', script]);
|
2021-04-08 23:55:45 -07:00
|
|
|
|
2022-09-16 17:53:18 -04:00
|
|
|
(async () => {
|
|
|
|
await cli.waitForInitialBreak();
|
|
|
|
await cli.waitForPrompt();
|
|
|
|
assert.match(cli.output, /debug>/, 'prints a prompt');
|
|
|
|
assert.match(
|
|
|
|
cli.output,
|
|
|
|
/< Debugger listening on /,
|
|
|
|
'forwards child output');
|
|
|
|
const code = await cli.quit();
|
|
|
|
assert.strictEqual(code, 0);
|
|
|
|
})().then(common.mustCall());
|