Skip to content
Myr

stdio.test-d.ts

This file

Path

test-d/subprocess/stdio.test-d.ts

104 lines · 5.5 KiB · TypeScript

Last changed by

Fix `execaNode()` and the `node` option missing IPC in their typesSindre Sorhusbefore adoption2633abb

History of this file

Take it

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

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 1why, one step back
1import type {Readable, Writable} from 'node:stream';

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 2why, one step back
2import {expectTypeOf} from 'nz';

Fix `execaNode()` and the `node` option missing IPC in their typesSindre Sorhusbefore adoption2633abb

line 3why, one step back
3import {execa, execaNode, type Subprocess} from '../../index.js';

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 4why, one step back
4

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 5–8why, one step back
5expectTypeOf<Subprocess['stdin']>().toBe<Writable | null>();
6expectTypeOf<Subprocess['stdout']>().toBe<Readable | null>();7expectTypeOf<Subprocess['stderr']>().toBe<Readable | null>();8expectTypeOf<Subprocess['all']>().toBe<Readable | undefined>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 9–10why, one step back
9
10const bufferSubprocess = execa('unicorns', {encoding: 'buffer', all: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 11–18why, one step back
11expectTypeOf(bufferSubprocess.stdin).toBe<Writable>();
12expectTypeOf(bufferSubprocess.stdio[0]).toBe<Writable>();13expectTypeOf(bufferSubprocess.stdout).toBe<Readable>();14expectTypeOf(bufferSubprocess.stdio[1]).toBe<Readable>();15expectTypeOf(bufferSubprocess.stderr).toBe<Readable>();16expectTypeOf(bufferSubprocess.stdio[2]).toBe<Readable>();17expectTypeOf(bufferSubprocess.all).toBe<Readable>();18expectTypeOf(bufferSubprocess.stdio[0]).toBe<Writable>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 19–20why, one step back
19
20const hexSubprocess = execa('unicorns', {encoding: 'hex', all: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 21–28why, one step back
21expectTypeOf(hexSubprocess.stdin).toBe<Writable>();
22expectTypeOf(hexSubprocess.stdio[0]).toBe<Writable>();23expectTypeOf(hexSubprocess.stdout).toBe<Readable>();24expectTypeOf(hexSubprocess.stdio[1]).toBe<Readable>();25expectTypeOf(hexSubprocess.stderr).toBe<Readable>();26expectTypeOf(hexSubprocess.stdio[2]).toBe<Readable>();27expectTypeOf(hexSubprocess.all).toBe<Readable>();28expectTypeOf(hexSubprocess.stdio[0]).toBe<Writable>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 29–30why, one step back
29
30const multipleStdinSubprocess = execa('unicorns', {stdin: ['inherit', 'pipe']});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 31why, one step back
31expectTypeOf(multipleStdinSubprocess.stdin).toBe<Writable>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 32–33why, one step back
32
33const multipleStdoutSubprocess = execa('unicorns', {stdout: ['inherit', 'pipe'] as ['inherit', 'pipe'], all: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 34–41why, one step back
34expectTypeOf(multipleStdoutSubprocess.stdin).toBe<Writable>();
35expectTypeOf(multipleStdoutSubprocess.stdio[0]).toBe<Writable>();36expectTypeOf(multipleStdoutSubprocess.stdout).toBe<Readable>();37expectTypeOf(multipleStdoutSubprocess.stdio[1]).toBe<Readable>();38expectTypeOf(multipleStdoutSubprocess.stderr).toBe<Readable>();39expectTypeOf(multipleStdoutSubprocess.stdio[2]).toBe<Readable>();40expectTypeOf(multipleStdoutSubprocess.all).toBe<Readable>();41expectTypeOf(multipleStdoutSubprocess.stdio[0]).toBe<Writable>();

Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4

lines 42–43why, one step back
42
43const inputPipeSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe', input: true}]});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 44why, one step back
44expectTypeOf(inputPipeSubprocess.stdio[3]).toBe<Writable>();

Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4

lines 45–46why, one step back
45
46const outputPipeSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe'}]});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 47why, one step back
47expectTypeOf(outputPipeSubprocess.stdio[3]).toBe<Readable>();

Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4

line 48why, one step back
48

Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba

line 49why, one step back
49const inputInheritSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'inherit', input: true}]});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 50why, one step back
50expectTypeOf(inputInheritSubprocess.stdio[3]).toBe<null>();

Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba

lines 51–52why, one step back
51
52const inputFdSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 3, input: true}]});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 53why, one step back
53expectTypeOf(inputFdSubprocess.stdio[3]).toBe<null>();

Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba

lines 54–55why, one step back
54
55const inputFileSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: {file: './example'}, input: true}]});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 56why, one step back
56expectTypeOf(inputFileSubprocess.stdio[3]).toBe<Writable>();

Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba

line 57why, one step back
57

Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d

lines 58–59why, one step back
58const isInput = true as boolean;
59const booleanInputPipeSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe', input: isInput}]});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 60why, one step back
60expectTypeOf(booleanInputPipeSubprocess.stdio[3]).toBe<Readable | Writable>();

Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4

line 61why, one step back
61

Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d

line 62why, one step back
62const optionalInputPipe: {readonly value: 'pipe'; readonly input?: boolean} = {value: 'pipe', input: isInput};

Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4

line 63why, one step back
63const optionalInputPipeSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', optionalInputPipe]});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 64why, one step back
64expectTypeOf(optionalInputPipeSubprocess.stdio[3]).toBe<Readable | Writable>();

Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4

lines 65–67why, one step back
65
66const optionalTrueInputPipe: {readonly value: 'pipe'; readonly input?: true} = {value: 'pipe', input: true};67const optionalTrueInputPipeSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', optionalTrueInputPipe]});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 68why, one step back
68expectTypeOf(optionalTrueInputPipeSubprocess.stdio[3]).toBe<Readable | Writable>();

Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4

lines 69–70why, one step back
69
70const stdoutInputPipeSubprocess = execa('unicorns', {stdout: {value: 'pipe', input: true}});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 71–72why, one step back
71expectTypeOf(stdoutInputPipeSubprocess.stdout).toBe<Readable>();
72expectTypeOf(stdoutInputPipeSubprocess.stdio[1]).toBe<Readable>();

Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4

lines 73–74why, one step back
73
74const stderrInputPipeSubprocess = execa('unicorns', {stderr: {value: 'pipe', input: true}});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 75–76why, one step back
75expectTypeOf(stderrInputPipeSubprocess.stderr).toBe<Readable>();
76expectTypeOf(stderrInputPipeSubprocess.stdio[2]).toBe<Readable>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

lines 77–78why, one step back
77
78const noIpcSubprocess = execa('unicorns');

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 79–81why, one step back
79expectTypeOf(noIpcSubprocess.stdio[0]).toBe<Writable>();
80expectTypeOf(noIpcSubprocess.stdio[1]).toBe<Readable>();81expectTypeOf(noIpcSubprocess.stdio[2]).toBe<Readable>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

lines 82–83why, one step back
82
83const ipcSubprocess = execa('unicorns', {ipc: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 84–87why, one step back
84expectTypeOf(ipcSubprocess.stdio[0]).toBe<Writable>();
85expectTypeOf(ipcSubprocess.stdio[1]).toBe<Readable>();86expectTypeOf(ipcSubprocess.stdio[2]).toBe<Readable>();87expectTypeOf(ipcSubprocess.stdio[3]).toBe<null>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

lines 88–89why, one step back
88
89const ipcInputSubprocess = execa('unicorns', {ipcInput: ''});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 90why, one step back
90expectTypeOf(ipcInputSubprocess.stdio[3]).toBe<null>();

Fix `execaNode()` and the `node` option missing IPC in their typesSindre Sorhusbefore adoption2633abb

lines 91–93why, one step back
91
92const execaNodeSubprocess = execaNode('unicorns');93expectTypeOf(execaNodeSubprocess.stdio[3]).toBe<null>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

lines 94–95why, one step back
94
95const fd3IpcSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'pipe'], ipc: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 96–97why, one step back
96expectTypeOf(fd3IpcSubprocess.stdio[3]).toBe<Readable>();
97expectTypeOf(fd3IpcSubprocess.stdio[4]).toBe<null>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

lines 98–99why, one step back
98
99const fd5IpcSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'pipe', 'pipe', 'pipe'], ipc: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 100–102why, one step back
100expectTypeOf(fd5IpcSubprocess.stdio[5]).toBe<Readable>();
101expectTypeOf(fd5IpcSubprocess.stdio[6]).toBe<null>();102expectTypeOf(fd5IpcSubprocess.stdio[7]).toBe<Readable | Writable | null>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

line 103why, one step back
103

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 104why, one step back
104expectTypeOf(noIpcSubprocess.stdio[3]).toBe<Readable | Writable | null>();