@@ -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) { |
|