Skip to content
Myr

send.test-d.ts

This file

Path

test-d/ipc/send.test-d.ts

59 lines · 2.9 KiB · TypeScript

Last changed by

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

History of this file

Take it

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

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

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 2–4why, one step back
2import {
3 sendMessage,4 execa,

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

line 5why, one step back
5 execaNode,

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 6–8why, one step back
6 type Message,
7 type Options,8} from '../../index.js';

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 9why, one step back
9

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 10why, one step back
10const subprocess = execa('test', {ipc: true});

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

lines 11–12why, one step back
11expectTypeOf(await subprocess.sendMessage('')).toBe<void>();
12expectTypeOf(sendMessage('')).toBe<Promise<void>>();

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 13why, one step back
13

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 14why, one step back
14expectError(await subprocess.sendMessage());

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 15why, one step back
15expectError(await sendMessage());

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 16why, one step back
16expectError(await subprocess.sendMessage(undefined));

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 17why, one step back
17expectError(await sendMessage(undefined));

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 18why, one step back
18expectError(await subprocess.sendMessage(0n));

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 19why, one step back
19expectError(await sendMessage(0n));

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 20why, one step back
20expectError(await subprocess.sendMessage(Symbol('test')));

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 21why, one step back
21expectError(await sendMessage(Symbol('test')));

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 22–24why, one step back
22
23await execa('test', {ipcInput: ''}).sendMessage('');24await execa('test', {ipcInput: '' as Message}).sendMessage('');

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

line 25why, one step back
25await execa('test', {gracefulCancel: true, cancelSignal: AbortSignal.abort()}).sendMessage('');

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

lines 26–28why, one step back
26await execa('test', {node: true}).sendMessage('');
27await execaNode('test').sendMessage('');28await execaNode({})`test`.sendMessage('');

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 29–31why, one step back
29await execa('test', {} as Options).sendMessage?.('');
30await execa('test', {ipc: true as boolean}).sendMessage?.('');31await execa('test', {ipcInput: '' as '' | undefined}).sendMessage?.('');

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

line 32why, one step back
32await execa('test', {gracefulCancel: true as boolean | undefined, cancelSignal: AbortSignal.abort()}).sendMessage?.('');

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

line 33why, one step back
33

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

lines 34–41why, one step back
34expectTypeOf(execa('test').sendMessage).toBe<undefined>();
35expectTypeOf(execa('test', {}).sendMessage).toBe<undefined>();36expectTypeOf(execa('test', {ipc: false}).sendMessage).toBe<undefined>();37expectTypeOf(execa('test', {ipcInput: undefined}).sendMessage).toBe<undefined>();38expectTypeOf(execa('test', {gracefulCancel: undefined}).sendMessage).toBe<undefined>();39expectTypeOf(execa('test', {gracefulCancel: false}).sendMessage).toBe<undefined>();40expectTypeOf(execa('test', {ipc: false, ipcInput: ''}).sendMessage).toBe<undefined>();41expectTypeOf(execa('test', {ipc: false, gracefulCancel: true, cancelSignal: AbortSignal.abort()}).sendMessage).toBe<undefined>();

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

lines 42–44why, one step back
42expectTypeOf(execa('test', {node: false}).sendMessage).toBe<undefined>();
43expectTypeOf(execa('test', {ipc: false, node: true}).sendMessage).toBe<undefined>();44expectTypeOf(execaNode('test', {ipc: false}).sendMessage).toBe<undefined>();

Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10

lines 45–49why, one step back
45
46await subprocess.sendMessage('', {} as const);47await sendMessage('', {} as const);48await subprocess.sendMessage('', {strict: true} as const);49await sendMessage('', {strict: true} as const);

Add more type tests (#1117)ehmickybefore adoption077749d

lines 50–51why, one step back
50await subprocess.sendMessage('', {strict: true as boolean});
51await sendMessage('', {strict: true as boolean});

Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10

lines 52–59why, one step back
52expectError(await subprocess.sendMessage('', true));
53expectError(await sendMessage('', true));54expectError(await subprocess.sendMessage('', {strict: 'true'}));55expectError(await sendMessage('', {strict: 'true'}));56expectError(await subprocess.sendMessage('', {unknown: true}));57expectError(await sendMessage('', {unknown: true}));58expectError(await subprocess.sendMessage('', {strict: true}, {}));59expectError(await sendMessage('', {strict: true}, {}));