get-one.test-d.ts
This file
Path
test-d/ipc/get-one.test-d.ts
70 lines · 4.1 KiB · TypeScript
Last changed by
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
History of this fileTake it
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 1why, one step back1import {expectTypeOf, expectError} from 'nz';Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
lines 2–7why, one step back2import {3 getOneMessage,4 execa,5 type Message,6 type Options,7} from '../../index.js';Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 8why, one step back8Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 9why, one step back9const subprocess = execa('test', {ipc: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 10why, one step back10expectTypeOf(subprocess.getOneMessage()).toBe<Promise<Message<'advanced'>>>();Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 11why, one step back11const jsonSubprocess = execa('test', {ipc: true, serialization: 'json'});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 12–13why, one step back12expectTypeOf(jsonSubprocess.getOneMessage()).toBe<Promise<Message<'json'>>>();13expectTypeOf(getOneMessage()).toBe<Promise<Message>>();Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 14–15why, one step back1415expectError(await subprocess.getOneMessage(''));Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 16why, one step back16expectError(await getOneMessage(''));Add `exchangeMessage()` method (#1077)ehmickybefore adoption7a0a1c6
lines 17–18why, one step back17expectError(await subprocess.getOneMessage({}, ''));18expectError(await getOneMessage({}, ''));Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
lines 19–21why, one step back1920await execa('test', {ipcInput: ''}).getOneMessage();21await execa('test', {ipcInput: '' as Message}).getOneMessage();Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
line 22why, one step back22await execa('test', {gracefulCancel: true, cancelSignal: AbortSignal.abort()}).getOneMessage();Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
lines 23–25why, one step back23await execa('test', {} as Options).getOneMessage?.();24await execa('test', {ipc: true as boolean}).getOneMessage?.();25await execa('test', {ipcInput: '' as '' | undefined}).getOneMessage?.();Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
line 26why, one step back26await execa('test', {gracefulCancel: true as boolean | undefined, cancelSignal: AbortSignal.abort()}).getOneMessage?.();Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
line 27why, one step back27Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 28–35why, one step back28expectTypeOf(execa('test').getOneMessage).toBe<undefined>();29expectTypeOf(execa('test', {}).getOneMessage).toBe<undefined>();30expectTypeOf(execa('test', {ipc: false}).getOneMessage).toBe<undefined>();31expectTypeOf(execa('test', {ipcInput: undefined}).getOneMessage).toBe<undefined>();32expectTypeOf(execa('test', {gracefulCancel: undefined}).getOneMessage).toBe<undefined>();33expectTypeOf(execa('test', {gracefulCancel: false}).getOneMessage).toBe<undefined>();34expectTypeOf(execa('test', {ipc: false, ipcInput: ''}).getOneMessage).toBe<undefined>();35expectTypeOf(execa('test', {ipc: false, gracefulCancel: true, cancelSignal: AbortSignal.abort()}).getOneMessage).toBe<undefined>();Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
lines 36–60why, one step back3637await subprocess.getOneMessage({filter: undefined} as const);38await subprocess.getOneMessage({filter: (message: Message<'advanced'>) => true} as const);39await jsonSubprocess.getOneMessage({filter: (message: Message<'json'>) => true} as const);40await jsonSubprocess.getOneMessage({filter: (message: Message<'advanced'>) => true} as const);41await subprocess.getOneMessage({filter: (message: Message<'advanced'> | bigint) => true} as const);42await subprocess.getOneMessage({filter: () => true} as const);43expectError(await subprocess.getOneMessage({filter: (message: Message<'advanced'>) => ''} as const));44// eslint-disable-next-line @typescript-eslint/no-empty-function45expectError(await subprocess.getOneMessage({filter(message: Message<'advanced'>) {}} as const));46expectError(await subprocess.getOneMessage({filter: (message: Message<'json'>) => true} as const));47expectError(await subprocess.getOneMessage({filter: (message: '') => true} as const));48expectError(await subprocess.getOneMessage({filter: true} as const));4950await getOneMessage({filter: undefined} as const);51await getOneMessage({filter: (message: Message) => true} as const);52await getOneMessage({filter: (message: Message<'advanced'>) => true} as const);53await getOneMessage({filter: (message: Message | bigint) => true} as const);54await getOneMessage({filter: () => true} as const);55expectError(await getOneMessage({filter: (message: Message) => ''} as const));56// eslint-disable-next-line @typescript-eslint/no-empty-function57expectError(await getOneMessage({filter(message: Message) {}} as const));58expectError(await getOneMessage({filter: (message: Message<'json'>) => true} as const));59expectError(await getOneMessage({filter: (message: '') => true} as const));60expectError(await getOneMessage({filter: true} as const));Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6
lines 61–62why, one step back6162expectError(await subprocess.getOneMessage({unknownOption: true} as const));Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 63why, one step back63expectError(await getOneMessage({unknownOption: true} as const));Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6
lines 64–66why, one step back6465await subprocess.getOneMessage({reference: true} as const);66await getOneMessage({reference: true} as const);Add more type tests (#1117)ehmickybefore adoption077749d
lines 67–68why, one step back67await subprocess.getOneMessage({reference: true as boolean});68await getOneMessage({reference: true as boolean});Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6
lines 69–70why, one step back69expectError(await subprocess.getOneMessage({reference: 'true'} as const));70expectError(await getOneMessage({reference: 'true'} as const));