Skip to content

Commit

Permalink
fixup! test,debugger: migrate node-inspect tests to core
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Apr 11, 2021
1 parent 3e4142f commit aef35b5
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 72 deletions.
30 changes: 30 additions & 0 deletions test/inspector-cli/test-inspector-cli-custom-port.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,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);
});
}
72 changes: 0 additions & 72 deletions test/inspector-cli/test-inspector-cli-launch-ports.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';
const common = require('../common');

common.skipIfInspectorDisabled();

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

const assert = require('assert');

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

const cli = startCLI(['--inspect-port=0', script]);

cli.waitForInitialBreak()
.then(() => cli.waitForPrompt())
.then(() => {
assert.match(cli.output, /debug>/, 'prints a prompt');
assert.match(
cli.output,
/< Debugger listening on /,
'forwards child output');
})
.then(() => cli.quit())
.then((code) => {
assert.strictEqual(code, 0);
});
}
30 changes: 30 additions & 0 deletions test/inspector-cli/test-inspector-cli-random-port.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';
const common = require('../common');

common.skipIfInspectorDisabled();

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

const assert = require('assert');

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

const cli = startCLI(['--port=0', script]);

cli.waitForInitialBreak()
.then(() => cli.waitForPrompt())
.then(() => {
assert.match(cli.output, /debug>/, 'prints a prompt');
assert.match(
cli.output,
/< Debugger listening on /,
'forwards child output');
})
.then(() => cli.quit())
.then((code) => {
assert.strictEqual(code, 0);
});
}

0 comments on commit aef35b5

Please sign in to comment.