Skip to content
Myr

command.executableSubcommand.inspect.test.js

This file

Path

tests/command.executableSubcommand.inspect.test.js

86 lines · 2.7 KiB · JavaScript

Last changed by

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

History of this file

Take it

The walk stopped after 200 commits: lines older than cc2db5b point at it.

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

lines 1–3why, one step back
1const childProcess = require('child_process');
2const path = require('path');3const util = require('util');

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

lines 4–5why, one step back
4const { test } = require('node:test');
5const assert = require('node:assert/strict');

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

lines 6–13why, 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.1112const inspectCommand = path.join(__dirname, './fixtures', 'inspect.js');13

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

line 14why, one step back
14test('when execArgv empty then spawn execArgs empty', async () => {

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

line 15why, one step back
15 const { stdout } = await execFileAsync('node', [inspectCommand, 'sub']);

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 16why, one step back
16 assert.equal(stdout, '[]\n');

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

lines 17–18why, one step back
17});
18

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 19–24why, one step back
19test('when execArgv --harmony then spawn execArgs --harmony', async () => {
20 const { stdout } = await execFileAsync('node', [21 '--harmony',22 inspectCommand,23 'sub',24 ]);

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 25why, one step back
25 assert.equal(stdout, "[ '--harmony' ]\n");

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

lines 26–28why, one step back
26});
2728// --inspect defaults to 127.0.0.1:9229, port should be incremented

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 29–34why, one step back
29test('when execArgv --inspect then spawn execArgs using port 9230', async () => {
30 const { stdout } = await execFileAsync('node', [31 '--inspect',32 inspectCommand,33 'sub',34 ]);

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 35why, one step back
35 assert.equal(stdout, "[ '--inspect=127.0.0.1:9230' ]\n");

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

lines 36–38why, one step back
36});
3738// custom port

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 39–44why, one step back
39test('when execArgv --inspect=9240 then spawn execArgs using port 9241', async () => {
40 const { stdout } = await execFileAsync('node', [41 '--inspect=9240',42 inspectCommand,43 'sub',44 ]);

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 45why, one step back
45 assert.equal(stdout, "[ '--inspect=127.0.0.1:9241' ]\n");

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

lines 46–48why, one step back
46});
4748// zero is special, random port

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 49–54why, one step back
49test('when execArgv --inspect=0 then spawn execArgs --inspect=0', async () => {
50 const { stdout } = await execFileAsync('node', [51 '--inspect=0',52 inspectCommand,53 'sub',54 ]);

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 55why, one step back
55 assert.equal(stdout, "[ '--inspect=0' ]\n");

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

lines 56–58why, one step back
56});
5758// ip address

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 59–64why, one step back
59test('when execArgv --inspect=127.0.0.1:9250 then spawn execArgs --inspect=127.0.0.1:9251', async () => {
60 const { stdout } = await execFileAsync('node', [61 '--inspect=127.0.0.1:9250',62 inspectCommand,63 'sub',64 ]);

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 65why, one step back
65 assert.equal(stdout, "[ '--inspect=127.0.0.1:9251' ]\n");

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

lines 66–68why, one step back
66});
6768// localhost

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 69–74why, one step back
69test('when execArgv --inspect=localhost:9260 then spawn execArgs --inspect=localhost:9261', async () => {
70 const { stdout } = await execFileAsync('node', [71 '--inspect=localhost:9260',72 inspectCommand,73 'sub',74 ]);

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 75why, one step back
75 assert.equal(stdout, "[ '--inspect=localhost:9261' ]\n");

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

lines 76–78why, one step back
76});
7778// --inspect-port, just test most likely format

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 79–84why, one step back
79test('when execArgv --inspect-port=9270 then spawn execArgs --inspect-port=127.0.0.1:9271', async () => {
80 const { stdout } = await execFileAsync('node', [81 '--inspect-port=9270',82 inspectCommand,83 'sub',84 ]);

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 85why, one step back
85 assert.equal(stdout, "[ '--inspect-port=127.0.0.1:9271' ]\n");

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

line 86why, one step back
86});