command.executableSubcommand.inspect.test.js
This file
Path
tests/command.executableSubcommand.inspect.test.js
92 lines · 2.9 KiB · JavaScript
Last changed by
Switching to esm-only (#2464)John Geebefore adoptionf4bd470
History of this fileTake it
The walk stopped after 200 commits: lines older than 471ec40 point at it.
Switching to esm-only (#2464)John Geebefore adoptionf4bd470
lines 1–5why, one step back1import * as childProcess from 'child_process';2import * as path from 'path';3import * as util from 'util';4import { test, describe } from 'node:test';5import assert from 'node:assert/strict';Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 6–11why, one step back67const execFileAsync = util.promisify(childProcess.execFile);89// Test the special handling for --inspect to increment fixed debug port numbers.10// If we reuse port we can get conflicts because port not released fast enough.11Switching to esm-only (#2464)John Geebefore adoptionf4bd470
lines 12–16why, one step back12const inspectCommand = path.join(13 import.meta.dirname,14 './fixtures',15 'inspect.js',16);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 17why, one step back17Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 18–22why, one step back18describe('executable subcommand support for --inspect ', () => {19 test('when execArgv empty then spawn execArgs empty', async () => {20 const { stdout } = await execFileAsync('node', [inspectCommand, 'sub']);21 assert.equal(stdout, '[]\n');22 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 23why, one step back23Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 24–29why, one step back24 test('when execArgv --harmony then spawn execArgs --harmony', async () => {25 const { stdout } = await execFileAsync('node', [26 '--harmony',27 inspectCommand,28 'sub',29 ]);Switching to esm-only (#2464)John Geebefore adoptionf4bd470
line 30why, one step back30 assert.equal(stdout, '["--harmony"]\n');Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 31why, one step back31 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 32why, one step back32Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 33–39why, one step back33 // --inspect defaults to 127.0.0.1:9229, port should be incremented34 test('when execArgv --inspect then spawn execArgs using port 9230', async () => {35 const { stdout } = await execFileAsync('node', [36 '--inspect',37 inspectCommand,38 'sub',39 ]);Switching to esm-only (#2464)John Geebefore adoptionf4bd470
line 40why, one step back40 assert.equal(stdout, '["--inspect=127.0.0.1:9230"]\n');Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 41why, one step back41 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 42why, one step back42Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 43–49why, one step back43 // custom port44 test('when execArgv --inspect=9240 then spawn execArgs using port 9241', async () => {45 const { stdout } = await execFileAsync('node', [46 '--inspect=9240',47 inspectCommand,48 'sub',49 ]);Switching to esm-only (#2464)John Geebefore adoptionf4bd470
line 50why, one step back50 assert.equal(stdout, '["--inspect=127.0.0.1:9241"]\n');Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 51why, one step back51 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 52why, one step back52Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 53–59why, one step back53 // zero is special, random port54 test('when execArgv --inspect=0 then spawn execArgs --inspect=0', async () => {55 const { stdout } = await execFileAsync('node', [56 '--inspect=0',57 inspectCommand,58 'sub',59 ]);Switching to esm-only (#2464)John Geebefore adoptionf4bd470
line 60why, one step back60 assert.equal(stdout, '["--inspect=0"]\n');Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 61why, one step back61 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 62why, one step back62Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 63–69why, one step back63 // ip address64 test('when execArgv --inspect=127.0.0.1:9250 then spawn execArgs --inspect=127.0.0.1:9251', async () => {65 const { stdout } = await execFileAsync('node', [66 '--inspect=127.0.0.1:9250',67 inspectCommand,68 'sub',69 ]);Switching to esm-only (#2464)John Geebefore adoptionf4bd470
line 70why, one step back70 assert.equal(stdout, '["--inspect=127.0.0.1:9251"]\n');Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 71why, one step back71 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 72why, one step back72Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 73–79why, one step back73 // localhost74 test('when execArgv --inspect=localhost:9260 then spawn execArgs --inspect=localhost:9261', async () => {75 const { stdout } = await execFileAsync('node', [76 '--inspect=localhost:9260',77 inspectCommand,78 'sub',79 ]);Switching to esm-only (#2464)John Geebefore adoptionf4bd470
line 80why, one step back80 assert.equal(stdout, '["--inspect=localhost:9261"]\n');Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 81why, one step back81 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 82why, one step back82Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 83–89why, one step back83 // --inspect-port, just test most likely format84 test('when execArgv --inspect-port=9270 then spawn execArgs --inspect-port=127.0.0.1:9271', async () => {85 const { stdout } = await execFileAsync('node', [86 '--inspect-port=9270',87 inspectCommand,88 'sub',89 ]);Switching to esm-only (#2464)John Geebefore adoptionf4bd470
line 90why, one step back90 assert.equal(stdout, '["--inspect-port=127.0.0.1:9271"]\n');Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 91why, one step back91 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 92why, one step back92});