| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8d869e6 commit 82d4175
35 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,10 +20,14 @@ function isPreBreak(output) { | |||
| 20 | 20 | return /Break on start/.test(output) && /1 \(function \(exports/.test(output); | |
| 21 | 21 | } | |
| 22 | 22 | ||
| 23 | - function startCLI(args, flags = [], spawnOpts = {}) { | ||
| 23 | + function startCLI(args, flags = [], spawnOpts = {}, opts = { randomPort: true }) { | ||
| 24 | 24 | let stderrOutput = ''; | |
| 25 | - const child = | ||
| 26 | - spawn(process.execPath, [...flags, 'inspect', ...args], spawnOpts); | ||
| 25 | + const child = spawn(process.execPath, [ | ||
| 26 | + ...flags, | ||
| 27 | + 'inspect', | ||
| 28 | + ...(opts.randomPort !== false ? ['--port=0'] : []), | ||
| 29 | + ...args, | ||
| 30 | + ], spawnOpts); | ||
| 27 | 31 | ||
| 28 | 32 | const outputBuffer = []; | |
| 29 | 33 | function bufferOutput(chunk) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,7 +55,7 @@ function launchTarget(...args) { | |||
| 55 | 55 | try { | |
| 56 | 56 | const { childProc, host, port } = await launchTarget('--inspect=0', script); | |
| 57 | 57 | target = childProc; | |
| 58 | - cli = startCLI([`${host || '127.0.0.1'}:${port}`]); | ||
| 58 | + cli = startCLI([`${host || '127.0.0.1'}:${port}`], [], {}, { randomPort: false }); | ||
| 59 | 59 | await cli.waitForPrompt(); | |
| 60 | 60 | await cli.command('sb("alive.js", 3)'); | |
| 61 | 61 | await cli.waitFor(/break/); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,9 +21,7 @@ addLibraryPath(process.env); | |||
| 21 | 21 | }; | |
| 22 | 22 | env.NODE_INSPECT_RESUME_ON_START = '1'; | |
| 23 | 23 | ||
| 24 | - const cli = startCLI(['--port=0', script], [], { | ||
| 25 | - env, | ||
| 26 | - }); | ||
| 24 | + const cli = startCLI([script], [], { env }); | ||
| 27 | 25 | ||
| 28 | 26 | await cli.waitForInitialBreak(); | |
| 29 | 27 | deepStrictEqual(cli.breakInfo, { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ const path = require('path'); | |||
| 13 | 13 | { | |
| 14 | 14 | const scriptFullPath = fixtures.path('debugger', 'backtrace.js'); | |
| 15 | 15 | const script = path.relative(process.cwd(), scriptFullPath); | |
| 16 | - const cli = startCLI(['--port=0', script]); | ||
| 16 | + const cli = startCLI([script]); | ||
| 17 | 17 | ||
| 18 | 18 | async function runTest() { | |
| 19 | 19 | try { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ const path = require('path'); | |||
| 11 | 11 | ||
| 12 | 12 | const scriptFullPath = fixtures.path('debugger', 'break.js'); | |
| 13 | 13 | const script = path.relative(process.cwd(), scriptFullPath); | |
| 14 | - const cli = startCLI(['--port=0', script]); | ||
| 14 | + const cli = startCLI([script]); | ||
| 15 | 15 | ||
| 16 | 16 | (async () => { | |
| 17 | 17 | await cli.waitForInitialBreak(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ const startCLI = require('../common/debugger'); | |||
| 9 | 9 | ||
| 10 | 10 | // Test for "Breakpoint at specified location already exists" error. | |
| 11 | 11 | const script = fixtures.path('debugger', 'three-lines.js'); | |
| 12 | - const cli = startCLI(['--port=0', script]); | ||
| 12 | + const cli = startCLI([script]); | ||
| 13 | 13 | ||
| 14 | 14 | (async () => { | |
| 15 | 15 | try { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ const path = require('path'); | |||
| 13 | 13 | { | |
| 14 | 14 | const scriptFullPath = fixtures.path('debugger', 'break.js'); | |
| 15 | 15 | const script = path.relative(process.cwd(), scriptFullPath); | |
| 16 | - const cli = startCLI(['--port=0', script]); | ||
| 16 | + const cli = startCLI([script]); | ||
| 17 | 17 | ||
| 18 | 18 | function onFatal(error) { | |
| 19 | 19 | cli.quit(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ const path = require('path'); | |||
| 13 | 13 | { | |
| 14 | 14 | const scriptFullPath = fixtures.path('debugger', 'exceptions.js'); | |
| 15 | 15 | const script = path.relative(process.cwd(), scriptFullPath); | |
| 16 | - const cli = startCLI(['--port=0', script]); | ||
| 16 | + const cli = startCLI([script]); | ||
| 17 | 17 | ||
| 18 | 18 | (async () => { | |
| 19 | 19 | try { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,7 @@ import startCLI from '../common/debugger.js'; | |||
| 7 | 7 | ||
| 8 | 8 | import assert from 'assert'; | |
| 9 | 9 | ||
| 10 | - const cli = startCLI(['--port=0', path('debugger/backtrace.js')]); | ||
| 10 | + const cli = startCLI([path('debugger/backtrace.js')]); | ||
| 11 | 11 | ||
| 12 | 12 | try { | |
| 13 | 13 | await cli.waitForInitialBreak(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ const startCLI = require('../common/debugger'); | |||
| 8 | 8 | ||
| 9 | 9 | const assert = require('assert'); | |
| 10 | 10 | ||
| 11 | - const cli = startCLI(['--port=0', fixtures.path('debugger/alive.js')]); | ||
| 11 | + const cli = startCLI([fixtures.path('debugger/alive.js')]); | ||
| 12 | 12 | ||
| 13 | 13 | async function waitInitialBreak() { | |
| 14 | 14 | try { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments