Skip to content
Myr

stdio.js

This file

Path

test/stdio.js

66 lines · 3.5 KiB · JavaScript

Last changed by

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

History of this file

Take it

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

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 1why, one step back
1import {inspect} from 'node:util';

Rename `.cmd` to `.command` (#194)Satya Rohithbefore adoption95c8a14

line 2why, one step back
2import test from 'ava';

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 3why, one step back
3import {normalizeStdio, normalizeStdioNode} from '../lib/stdio.js';

Rename `.cmd` to `.command` (#194)Satya Rohithbefore adoption95c8a14

line 4why, one step back
4

Simplify tests for stdio (#300)ehmickybefore adoptionab83d8d

lines 5–7why, one step back
5const macro = (t, input, expected, func) => {
6 if (expected instanceof Error) {7 t.throws(() => {

Rename variables in `stdio` file (#306)ehmickybefore adoptiona9fa13f

line 8why, one step back
8 normalizeStdio(input);

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 9why, one step back
9 }, {message: expected.message});

Simplify tests for stdio (#300)ehmickybefore adoptionab83d8d

lines 10–11why, one step back
10 return;
11 }

Rename `.cmd` to `.command` (#194)Satya Rohithbefore adoption95c8a14

line 12why, one step back
12

Simplify tests for stdio (#300)ehmickybefore adoptionab83d8d

lines 13–14why, one step back
13 t.deepEqual(func(input), expected);
14};

Rename `.cmd` to `.command` (#194)Satya Rohithbefore adoption95c8a14

line 15why, one step back
15

Upgrade dependenciesSindre Sorhusbefore adoption5d64878

line 16why, one step back
16const macroTitle = name => (title, input) => `${name} ${(inspect(input))}`;

Rename `.cmd` to `.command` (#194)Satya Rohithbefore adoption95c8a14

line 17why, one step back
17

Rename variables in `stdio` file (#306)ehmickybefore adoptiona9fa13f

line 18why, one step back
18const stdioMacro = (...args) => macro(...args, normalizeStdio);

Simplify tests for stdio (#300)ehmickybefore adoptionab83d8d

line 19why, one step back
19stdioMacro.title = macroTitle('execa()');

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 20–22why, one step back
20
21test(stdioMacro, undefined, undefined);22test(stdioMacro, null, undefined);

Rename `.cmd` to `.command` (#194)Satya Rohithbefore adoption95c8a14

line 23why, one step back
23

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 24–27why, one step back
24test(stdioMacro, {stdio: 'inherit'}, 'inherit');
25test(stdioMacro, {stdio: 'pipe'}, 'pipe');26test(stdioMacro, {stdio: 'ignore'}, 'ignore');27test(stdioMacro, {stdio: [0, 1, 2]}, [0, 1, 2]);

Rename `.cmd` to `.command` (#194)Satya Rohithbefore adoption95c8a14

line 28why, one step back
28

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 29–41why, one step back
29test(stdioMacro, {}, [undefined, undefined, undefined]);
30test(stdioMacro, {stdio: []}, [undefined, undefined, undefined]);31test(stdioMacro, {stdin: 'pipe'}, ['pipe', undefined, undefined]);32test(stdioMacro, {stdout: 'ignore'}, [undefined, 'ignore', undefined]);33test(stdioMacro, {stderr: 'inherit'}, [undefined, undefined, 'inherit']);34test(stdioMacro, {stdin: 'pipe', stdout: 'ignore', stderr: 'inherit'}, ['pipe', 'ignore', 'inherit']);35test(stdioMacro, {stdin: 'pipe', stdout: 'ignore'}, ['pipe', 'ignore', undefined]);36test(stdioMacro, {stdin: 'pipe', stderr: 'inherit'}, ['pipe', undefined, 'inherit']);37test(stdioMacro, {stdout: 'ignore', stderr: 'inherit'}, [undefined, 'ignore', 'inherit']);38test(stdioMacro, {stdin: 0, stdout: 1, stderr: 2}, [0, 1, 2]);39test(stdioMacro, {stdin: 0, stdout: 1}, [0, 1, undefined]);40test(stdioMacro, {stdin: 0, stderr: 2}, [0, undefined, 2]);41test(stdioMacro, {stdout: 1, stderr: 2}, [undefined, 1, 2]);

Rename `.cmd` to `.command` (#194)Satya Rohithbefore adoption95c8a14

line 42why, one step back
42

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

line 43why, one step back
43test(stdioMacro, {stdio: {foo: 'bar'}}, new TypeError('Expected `stdio` to be of type `string` or `Array`, got `object`'));

Rename `.cmd` to `.command` (#194)Satya Rohithbefore adoption95c8a14

line 44why, one step back
44

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 45–47why, one step back
45test(stdioMacro, {stdin: 'inherit', stdio: 'pipe'}, new Error('It\'s not possible to provide `stdio` in combination with one of `stdin`, `stdout`, `stderr`'));
46test(stdioMacro, {stdin: 'inherit', stdio: ['pipe']}, new Error('It\'s not possible to provide `stdio` in combination with one of `stdin`, `stdout`, `stderr`'));47test(stdioMacro, {stdin: 'inherit', stdio: [undefined, 'pipe']}, new Error('It\'s not possible to provide `stdio` in combination with one of `stdin`, `stdout`, `stderr`'));

Do not allow `stdin: 0` combined with `stdio` (#301)ehmickybefore adoption2c65870

line 48why, one step back
48test(stdioMacro, {stdin: 0, stdio: 'pipe'}, new Error('It\'s not possible to provide `stdio` in combination with one of `stdin`, `stdout`, `stderr`'));

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

line 49why, one step back
49

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 50–51why, one step back
50const forkMacro = (...args) => macro(...args, normalizeStdioNode);
51forkMacro.title = macroTitle('execaNode()');

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

line 52why, one step back
52

Refactor `stdio` option for `execa.node()` (#303)ehmickybefore adoption825f8a7

line 53why, one step back
53test(forkMacro, undefined, [undefined, undefined, undefined, 'ipc']);

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

line 54why, one step back
54test(forkMacro, {stdio: 'ignore'}, ['ignore', 'ignore', 'ignore', 'ipc']);

Refactor `stdio` option for `execa.node()` (#303)ehmickybefore adoption825f8a7

line 55why, one step back
55test(forkMacro, {stdio: 'ipc'}, 'ipc');

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 56–59why, one step back
56test(forkMacro, {stdio: [0, 1, 2]}, [0, 1, 2, 'ipc']);
57test(forkMacro, {stdio: [0, 1, 2, 3]}, [0, 1, 2, 3, 'ipc']);58test(forkMacro, {stdio: [0, 1, 2, 'ipc']}, [0, 1, 2, 'ipc']);59

Refactor `stdio` option for `execa.node()` (#303)ehmickybefore adoption825f8a7

lines 60–63why, one step back
60test(forkMacro, {stdio: [0, 1, undefined]}, [0, 1, undefined, 'ipc']);
61test(forkMacro, {stdio: [0, 1, 2, undefined]}, [0, 1, 2, undefined, 'ipc']);62test(forkMacro, {stdout: 'ignore'}, [undefined, 'ignore', undefined, 'ipc']);63test(forkMacro, {stdout: 'ignore', stderr: 'ignore'}, [undefined, 'ignore', 'ignore', 'ipc']);

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 64–66why, one step back
64
65test(forkMacro, {stdio: {foo: 'bar'}}, new TypeError('Expected `stdio` to be of type `string` or `Array`, got `object`'));66test(forkMacro, {stdin: 'inherit', stdio: 'pipe'}, new Error('It\'s not possible to provide `stdio` in combination with one of `stdin`, `stdout`, `stderr`'));