Skip to content
Myr

get-each.test-d.ts

This file

Path

test-d/ipc/get-each.test-d.ts

48 lines · 2.1 KiB · TypeScript

Last changed by

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

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–7why, one step back
2import {
3 getEachMessage,4 execa,5 type Message,6 type Options,7} from '../../index.js';

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 8–11why, one step back
8
9const subprocess = execa('test', {ipc: true});1011for await (const message of subprocess.getEachMessage()) {

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

line 12why, one step back
12 expectTypeOf(message).toBe<Message<'advanced'>>();

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 13–15why, one step back
13}
1415for await (const message of execa('test', {ipc: true, serialization: 'json'}).getEachMessage()) {

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

line 16why, one step back
16 expectTypeOf(message).toBe<Message<'json'>>();

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 17–18why, one step back
17}
18

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

line 19why, one step back
19for await (const message of getEachMessage()) {

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

line 20why, one step back
20 expectTypeOf(message).toBe<Message>();

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

lines 21–22why, one step back
21}
22

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 23why, one step back
23expectError(subprocess.getEachMessage(''));

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

line 24why, one step back
24expectError(getEachMessage(''));

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 25–27why, one step back
25
26execa('test', {ipcInput: ''}).getEachMessage();27execa('test', {ipcInput: '' as Message}).getEachMessage();

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

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

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

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

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

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

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').getEachMessage).toBe<undefined>();
35expectTypeOf(execa('test', {}).getEachMessage).toBe<undefined>();36expectTypeOf(execa('test', {ipc: false}).getEachMessage).toBe<undefined>();37expectTypeOf(execa('test', {ipcInput: undefined}).getEachMessage).toBe<undefined>();38expectTypeOf(execa('test', {gracefulCancel: undefined}).getEachMessage).toBe<undefined>();39expectTypeOf(execa('test', {gracefulCancel: false}).getEachMessage).toBe<undefined>();40expectTypeOf(execa('test', {ipc: false, ipcInput: ''}).getEachMessage).toBe<undefined>();41expectTypeOf(execa('test', {ipc: false, gracefulCancel: true, cancelSignal: AbortSignal.abort()}).getEachMessage).toBe<undefined>();

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 42why, one step back
42

Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6

lines 43–44why, one step back
43subprocess.getEachMessage({reference: true} as const);
44getEachMessage({reference: true} as const);

Add more type tests (#1117)ehmickybefore adoption077749d

lines 45–46why, one step back
45subprocess.getEachMessage({reference: true as boolean});
46getEachMessage({reference: true as boolean});

Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6

lines 47–48why, one step back
47expectError(subprocess.getEachMessage({reference: 'true'} as const));
48expectError(getEachMessage({reference: 'true'} as const));