Skip to content
Myr

subprocess.test-d.ts

This file

Path

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

40 lines · 1.6 KiB · TypeScript

Last changed by

Improve validation and typing of signals (#1025)ehmickybefore adoption7213287

History of this file

Take it

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 1why, one step back
1import {expectType, expectError, expectAssignable} from 'tsd';

Rename some types (#1009)ehmickybefore adoption2ef9186

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

Split type files (#978)ehmickybefore adoption0bd0f0d

line 3why, one step back
3

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 4why, one step back
4const subprocess = execa('unicorns');

Rename some types (#1009)ehmickybefore adoption2ef9186

line 5why, one step back
5expectAssignable<Subprocess>(subprocess);

Split type files (#978)ehmickybefore adoption0bd0f0d

line 6why, one step back
6

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 7why, one step back
7expectType<number | undefined>(subprocess.pid);

Split type files (#978)ehmickybefore adoption0bd0f0d

line 8why, one step back
8

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

lines 9–16why, one step back
9expectType<boolean>(subprocess.kill());
10subprocess.kill('SIGKILL');11subprocess.kill(undefined);12subprocess.kill(new Error('test'));13subprocess.kill('SIGKILL', new Error('test'));14subprocess.kill(undefined, new Error('test'));15expectError(subprocess.kill(null));16expectError(subprocess.kill(0n));

Improve validation and typing of signals (#1025)ehmickybefore adoption7213287

lines 17–22why, one step back
17expectError(subprocess.kill('Sigkill'));
18expectError(subprocess.kill('sigkill'));19expectError(subprocess.kill('SIGOTHER'));20expectError(subprocess.kill('SIGEMT'));21expectError(subprocess.kill('SIGCLD'));22expectError(subprocess.kill('SIGRT1'));

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

lines 23–27why, one step back
23expectError(subprocess.kill([new Error('test')]));
24expectError(subprocess.kill({message: 'test'}));25expectError(subprocess.kill(undefined, {}));26expectError(subprocess.kill('SIGKILL', {}));27expectError(subprocess.kill(null, new Error('test')));

Split type files (#978)ehmickybefore adoption0bd0f0d

line 28why, one step back
28

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 29why, one step back
29const ipcSubprocess = execa('unicorns', {ipc: true});

Rename some types (#1009)ehmickybefore adoption2ef9186

line 30why, one step back
30expectAssignable<Subprocess>(subprocess);

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

lines 31–32why, one step back
31
32expectType<boolean>(ipcSubprocess.send({}));

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 33–34why, one step back
33execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'ipc']}).send({});
34execa('unicorns', {stdio: ['pipe', 'pipe', 'ipc', 'pipe']}).send({});

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

lines 35–37why, one step back
35ipcSubprocess.send('message');
36ipcSubprocess.send({}, undefined, {keepOpen: true});37expectError(ipcSubprocess.send({}, true));

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 38–40why, one step back
38expectType<undefined>(execa('unicorns', {}).send);
39expectType<undefined>(execa('unicorns', {ipc: false}).send);40expectType<undefined>(execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'pipe']}).send);