summaryrefslogtreecommitdiff
path: root/test/inspector-cli/test-inspector-cli-custom-port.js
blob: 4b788a6488169a0a52a8a7c040007226e6ad2a27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict';
const common = require('../common');

common.skipIfInspectorDisabled();

const fixtures = require('../common/fixtures');
const startCLI = require('../common/inspector-cli');

const assert = require('assert');

// Custom port.
{
  const script = fixtures.path('inspector-cli', 'three-lines.js');

  const cli = startCLI([`--port=${common.PORT}`, script]);

  cli.waitForInitialBreak()
    .then(() => cli.waitForPrompt())
    .then(() => {
      assert.match(cli.output, /debug>/, 'prints a prompt');
      assert.match(
        cli.output,
        new RegExp(`< Debugger listening on [^\n]*${common.PORT}`),
        'forwards child output');
    })
    .then(() => cli.quit())
    .then((code) => {
      assert.strictEqual(code, 0);
    });
}