Skip to content
Myr

command.executableSubcommand.inspect.test.js

This file

Path

tests/command.executableSubcommand.inspect.test.js

84 lines · 2.6 KiB · JavaScript

Last changed by

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

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–11why, one step back
1const childProcess = require('child_process');
2const path = require('path');3const util = require('util');45const execFileAsync = util.promisify(childProcess.execFile);67// Test the special handling for --inspect to increment fixed debug port numbers.8// If we reuse port we can get conflicts because port not released fast enough.910const inspectCommand = path.join(__dirname, './fixtures', 'inspect.js');11

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

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

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

lines 13–16why, one step back
13 const { stdout } = await execFileAsync('node', [inspectCommand, 'sub']);
14 expect(stdout).toBe('[]\n');15});16

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

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

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

lines 23–26why, one step back
23 expect(stdout).toBe("[ '--harmony' ]\n");
24});2526// --inspect defaults to 127.0.0.1:9229, port should be incremented

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

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

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

lines 33–36why, one step back
33 expect(stdout).toBe("[ '--inspect=127.0.0.1:9230' ]\n");
34});3536// custom port

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

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

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

lines 43–46why, one step back
43 expect(stdout).toBe("[ '--inspect=127.0.0.1:9241' ]\n");
44});4546// zero is special, random port

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

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

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

lines 53–56why, one step back
53 expect(stdout).toBe("[ '--inspect=0' ]\n");
54});5556// ip address

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

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

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

lines 63–66why, one step back
63 expect(stdout).toBe("[ '--inspect=127.0.0.1:9251' ]\n");
64});6566// localhost

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

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

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

lines 73–76why, one step back
73 expect(stdout).toBe("[ '--inspect=localhost:9261' ]\n");
74});7576// --inspect-port, just test most likely format

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

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

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

lines 83–84why, one step back
83 expect(stdout).toBe("[ '--inspect-port=127.0.0.1:9271' ]\n");
84});