Skip to content

Commit 9c0441e

Browse files
committed
test: use --port=0 in debugger tests that do not have to work on 9229
To avoid failures when there is another running process occupying the port 9229 which may happen if there is a stale process, use the --port argument of node-inspect to use a random port in tests that don't have to work on port 9229. The following tests are not touched: - test-debugger-launch: specifically needs to test port 9229 - test-debugger-pid: needs modifications to node-inspect - test-debugger-random-port-with-inspect-port: same as -pid test
1 parent fd07bab commit 9c0441e

22 files changed

+22
-22
lines changed

test/sequential/test-debugger-auto-resume.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ addLibraryPath(process.env);
2020
const env = { ...process.env };
2121
env.NODE_INSPECT_RESUME_ON_START = '1';
2222

23-
const cli = startCLI([script], [], { env });
23+
const cli = startCLI(['--port=0', script], [], { env });
2424

2525
cli.waitForInitialBreak()
2626
.then(() => {

test/sequential/test-debugger-backtrace.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const path = require('path');
1313
{
1414
const scriptFullPath = fixtures.path('debugger', 'backtrace.js');
1515
const script = path.relative(process.cwd(), scriptFullPath);
16-
const cli = startCLI([script]);
16+
const cli = startCLI(['--port=0', script]);
1717

1818
function onFatal(error) {
1919
cli.quit();

test/sequential/test-debugger-break.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const path = require('path');
1313
{
1414
const scriptFullPath = fixtures.path('debugger', 'break.js');
1515
const script = path.relative(process.cwd(), scriptFullPath);
16-
const cli = startCLI([script]);
16+
const cli = startCLI(['--port=0', script]);
1717

1818
function onFatal(error) {
1919
cli.quit();

test/sequential/test-debugger-breakpoint-exists.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const startCLI = require('../common/debugger');
1010
// Test for "Breakpoint at specified location already exists" error.
1111
{
1212
const script = fixtures.path('debugger', 'three-lines.js');
13-
const cli = startCLI([script]);
13+
const cli = startCLI(['--port=0', script]);
1414

1515
function onFatal(error) {
1616
cli.quit();

test/sequential/test-debugger-clear-breakpoints.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const path = require('path');
1313
{
1414
const scriptFullPath = fixtures.path('debugger', 'break.js');
1515
const script = path.relative(process.cwd(), scriptFullPath);
16-
const cli = startCLI([script]);
16+
const cli = startCLI(['--port=0', script]);
1717

1818
function onFatal(error) {
1919
cli.quit();

test/sequential/test-debugger-exceptions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const path = require('path');
1313
{
1414
const scriptFullPath = fixtures.path('debugger', 'exceptions.js');
1515
const script = path.relative(process.cwd(), scriptFullPath);
16-
const cli = startCLI([script]);
16+
const cli = startCLI(['--port=0', script]);
1717

1818
function onFatal(error) {
1919
cli.quit();

test/sequential/test-debugger-exec-scope.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const assert = require('assert');
1010

1111
// exec .scope
1212
{
13-
const cli = startCLI([fixtures.path('debugger/backtrace.js')]);
13+
const cli = startCLI(['--port=0', fixtures.path('debugger/backtrace.js')]);
1414

1515
function onFatal(error) {
1616
cli.quit();

test/sequential/test-debugger-exec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const assert = require('assert');
1010

1111
{
1212

13-
const cli = startCLI([fixtures.path('debugger/alive.js')]);
13+
const cli = startCLI(['--port=0', fixtures.path('debugger/alive.js')]);
1414

1515
function onFatal(error) {
1616
cli.quit();

test/sequential/test-debugger-heap-profiler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const filename = path.join(tmpdir.path, 'node.heapsnapshot');
1717
// Heap profiler take snapshot.
1818
{
1919
const opts = { cwd: tmpdir.path };
20-
const cli = startCLI([fixtures.path('debugger/empty.js')], [], opts);
20+
const cli = startCLI(['--port=0', fixtures.path('debugger/empty.js')], [], opts);
2121

2222
function onFatal(error) {
2323
cli.quit();

test/sequential/test-debugger-help.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const startCLI = require('../common/debugger');
99
const assert = require('assert');
1010

1111
{
12-
const cli = startCLI([fixtures.path('debugger/empty.js')]);
12+
const cli = startCLI(['--port=0', fixtures.path('debugger/empty.js')]);
1313

1414
function onFatal(error) {
1515
cli.quit();

test/sequential/test-debugger-list.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const startCLI = require('../common/debugger');
88

99
const assert = require('assert');
1010

11-
const cli = startCLI([fixtures.path('debugger/three-lines.js')]);
11+
const cli = startCLI(['--port=0', fixtures.path('debugger/three-lines.js')]);
1212

1313
(async () => {
1414
await cli.waitForInitialBreak();

test/sequential/test-debugger-low-level.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const assert = require('assert');
99

1010
// Debugger agent direct access.
1111
{
12-
const cli = startCLI([fixtures.path('debugger/three-lines.js')]);
12+
const cli = startCLI(['--port=0', fixtures.path('debugger/three-lines.js')]);
1313
const scriptPattern = /^\* (\d+): \S+debugger(?:\/|\\)three-lines\.js/m;
1414

1515
function onFatal(error) {

test/sequential/test-debugger-object-type-remote-object.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const startCLI = require('../common/debugger');
88

99
const assert = require('assert');
1010

11-
const cli = startCLI([fixtures.path('debugger/empty.js')]);
11+
const cli = startCLI(['--port=0', fixtures.path('debugger/empty.js')]);
1212

1313
(async () => {
1414
await cli.waitForInitialBreak();

test/sequential/test-debugger-preserve-breaks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const path = require('path');
1313
{
1414
const scriptFullPath = fixtures.path('debugger', 'three-lines.js');
1515
const script = path.relative(process.cwd(), scriptFullPath);
16-
const cli = startCLI([script]);
16+
const cli = startCLI(['--port=0', script]);
1717

1818
function onFatal(error) {
1919
cli.quit();

test/sequential/test-debugger-profile-command.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const assert = require('assert');
1010
const fs = require('fs');
1111
const path = require('path');
1212

13-
const cli = startCLI([fixtures.path('debugger/empty.js')]);
13+
const cli = startCLI(['--port=0', fixtures.path('debugger/empty.js')]);
1414

1515
const rootDir = path.resolve(__dirname, '..', '..');
1616

test/sequential/test-debugger-profile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function delay(ms) {
1414

1515
// Profiles.
1616
{
17-
const cli = startCLI([fixtures.path('debugger/empty.js')]);
17+
const cli = startCLI(['--port=0', fixtures.path('debugger/empty.js')]);
1818

1919
function onFatal(error) {
2020
cli.quit();

test/sequential/test-debugger-restart-message.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const startCLI = require('../common/debugger');
1414
// Using `restart` should result in only one "Connect/For help" message.
1515
{
1616
const script = fixtures.path('debugger', 'three-lines.js');
17-
const cli = startCLI([script]);
17+
const cli = startCLI(['--port=0', script]);
1818

1919
function onFatal(error) {
2020
cli.quit();

test/sequential/test-debugger-run-after-quit-restart.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const path = require('path');
1313
{
1414
const scriptFullPath = fixtures.path('debugger', 'three-lines.js');
1515
const script = path.relative(process.cwd(), scriptFullPath);
16-
const cli = startCLI([script]);
16+
const cli = startCLI(['--port=0', script]);
1717

1818
function onFatal(error) {
1919
cli.quit();

test/sequential/test-debugger-sb-before-load.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const path = require('path');
1717
const otherScriptFullPath = fixtures.path('debugger', 'cjs', 'other.js');
1818
const otherScript = path.relative(process.cwd(), otherScriptFullPath);
1919

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

2222
function onFatal(error) {
2323
cli.quit();

test/sequential/test-debugger-scripts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const assert = require('assert');
1111
// List scripts.
1212
{
1313
const script = fixtures.path('debugger', 'three-lines.js');
14-
const cli = startCLI([script]);
14+
const cli = startCLI(['--port=0', script]);
1515

1616
function onFatal(error) {
1717
cli.quit();

test/sequential/test-debugger-use-strict.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const assert = require('assert');
1111
// Test for files that start with strict directive.
1212
{
1313
const script = fixtures.path('debugger', 'use-strict.js');
14-
const cli = startCLI([script]);
14+
const cli = startCLI(['--port=0', script]);
1515

1616
function onFatal(error) {
1717
cli.quit();

test/sequential/test-debugger-watchers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const assert = require('assert');
1010

1111
// Stepping through breakpoints.
1212
{
13-
const cli = startCLI([fixtures.path('debugger/break.js')]);
13+
const cli = startCLI(['--port=0', fixtures.path('debugger/break.js')]);
1414

1515
function onFatal(error) {
1616
cli.quit();

0 commit comments

Comments
 (0)