Skip to content
Myr

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 file

Take 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 back
1import * 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 back
6
7const 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.11

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

lines 12–16why, one step back
12const 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 back
17

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 18–22why, one step back
18describe('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 back
23

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 24–29why, one step back
24 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 back
30 assert.equal(stdout, '["--harmony"]\n');

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

line 31why, one step back
31 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 32why, one step back
32

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 33–39why, one step back
33 // --inspect defaults to 127.0.0.1:9229, port should be incremented
34 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 back
40 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 back
41 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 42why, one step back
42

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 43–49why, one step back
43 // custom port
44 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 back
50 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 back
51 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 52why, one step back
52

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 53–59why, one step back
53 // zero is special, random port
54 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 back
60 assert.equal(stdout, '["--inspect=0"]\n');

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

line 61why, one step back
61 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 62why, one step back
62

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 63–69why, one step back
63 // ip address
64 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 back
70 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 back
71 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 72why, one step back
72

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 73–79why, one step back
73 // localhost
74 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 back
80 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 back
81 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 82why, one step back
82

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 83–89why, one step back
83 // --inspect-port, just test most likely format
84 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 back
90 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 back
91 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 92why, one step back
92});