• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import { skipIfInspectorDisabled } from '../common/index.mjs';
2skipIfInspectorDisabled();
3
4// This must be in sequential because we check that the default port is 9229.
5import { path } from '../common/fixtures.mjs';
6import startCLI from '../common/debugger.js';
7
8import assert from 'assert';
9
10const script = path('debugger', 'three-lines.js');
11const cli = startCLI([script]);
12try {
13  await cli.waitForInitialBreak();
14  await cli.waitForPrompt();
15  assert.match(cli.output, /debug>/, 'prints a prompt');
16  assert.match(
17    cli.output,
18    /< Debugger listening on [^\n]*9229/,
19    'forwards child output'
20  );
21  await cli.command('["hello", "world"].join(" ")');
22  assert.match(cli.output, /hello world/, 'prints the result');
23  await cli.command('');
24  assert.match(
25    cli.output,
26    /hello world/,
27    'repeats the last command on <enter>'
28  );
29  await cli.command('version');
30  assert.ok(
31    cli.output.includes(process.versions.v8),
32    'version prints the v8 version'
33  );
34} finally {
35  const code = await cli.quit();
36  assert.strictEqual(code, 0);
37}
38