Skip to content
Myr

command.executableSubcommand.inspect.test.js

This file

Path

tests/command.executableSubcommand.inspect.test.js

88 lines · 2.9 KiB · JavaScript

Last changed by

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

History of this file

Take it

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

Add more tests for implies (#1730)John Geebefore adoption3103c6b

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

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

line 4why, one step back
4const { test, describe } = require('node:test');

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

line 5why, one step back
5const assert = require('node:assert/strict');

Add more tests for implies (#1730)John Geebefore adoption3103c6b

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

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

lines 14–18why, one step back
14describe('executable subcommand support for --inspect ', () => {
15 test('when execArgv empty then spawn execArgs empty', async () => {16 const { stdout } = await execFileAsync('node', [inspectCommand, 'sub']);17 assert.equal(stdout, '[]\n');18 });

Add more tests for implies (#1730)John Geebefore adoption3103c6b

line 19why, one step back
19

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

lines 20–27why, one step back
20 test('when execArgv --harmony then spawn execArgs --harmony', async () => {
21 const { stdout } = await execFileAsync('node', [22 '--harmony',23 inspectCommand,24 'sub',25 ]);26 assert.equal(stdout, "[ '--harmony' ]\n");27 });

Add more tests for implies (#1730)John Geebefore adoption3103c6b

line 28why, one step back
28

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

lines 29–37why, one step back
29 // --inspect defaults to 127.0.0.1:9229, port should be incremented
30 test('when execArgv --inspect then spawn execArgs using port 9230', async () => {31 const { stdout } = await execFileAsync('node', [32 '--inspect',33 inspectCommand,34 'sub',35 ]);36 assert.equal(stdout, "[ '--inspect=127.0.0.1:9230' ]\n");37 });

Add more tests for implies (#1730)John Geebefore adoption3103c6b

line 38why, one step back
38

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

lines 39–47why, one step back
39 // custom port
40 test('when execArgv --inspect=9240 then spawn execArgs using port 9241', async () => {41 const { stdout } = await execFileAsync('node', [42 '--inspect=9240',43 inspectCommand,44 'sub',45 ]);46 assert.equal(stdout, "[ '--inspect=127.0.0.1:9241' ]\n");47 });

Add more tests for implies (#1730)John Geebefore adoption3103c6b

line 48why, one step back
48

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

lines 49–57why, one step back
49 // zero is special, random port
50 test('when execArgv --inspect=0 then spawn execArgs --inspect=0', async () => {51 const { stdout } = await execFileAsync('node', [52 '--inspect=0',53 inspectCommand,54 'sub',55 ]);56 assert.equal(stdout, "[ '--inspect=0' ]\n");57 });

Add more tests for implies (#1730)John Geebefore adoption3103c6b

line 58why, one step back
58

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

lines 59–67why, one step back
59 // ip address
60 test('when execArgv --inspect=127.0.0.1:9250 then spawn execArgs --inspect=127.0.0.1:9251', async () => {61 const { stdout } = await execFileAsync('node', [62 '--inspect=127.0.0.1:9250',63 inspectCommand,64 'sub',65 ]);66 assert.equal(stdout, "[ '--inspect=127.0.0.1:9251' ]\n");67 });

Add more tests for implies (#1730)John Geebefore adoption3103c6b

line 68why, one step back
68

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

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

Add more tests for implies (#1730)John Geebefore adoption3103c6b

line 78why, one step back
78

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

lines 79–87why, one step back
79 // --inspect-port, just test most likely format
80 test('when execArgv --inspect-port=9270 then spawn execArgs --inspect-port=127.0.0.1:9271', async () => {81 const { stdout } = await execFileAsync('node', [82 '--inspect-port=9270',83 inspectCommand,84 'sub',85 ]);86 assert.equal(stdout, "[ '--inspect-port=127.0.0.1:9271' ]\n");87 });

Add more tests for implies (#1730)John Geebefore adoption3103c6b

line 88why, one step back
88});