Skip to content
Myr

main-sync.test-d.ts

This file

Path

test-d/methods/main-sync.test-d.ts

55 lines · 3.1 KiB · TypeScript

Last changed by

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

History of this file

Take it

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

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

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

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 2–9why, one step back
2import {execaSync, type SyncResult} from '../../index.js';
34const fileUrl = new URL('file:///test');5const stringArray = ['foo', 'bar'] as const;67expectError(execaSync());8expectError(execaSync(true));9expectError(execaSync(['unicorns', 'arg']));

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

lines 10–11why, one step back
10expectTypeOf(execaSync('unicorns')).toBe<SyncResult<{}>>();
11expectTypeOf(execaSync(fileUrl)).toBe<SyncResult<{}>>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 12why, one step back
12

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

lines 13–14why, one step back
13expectTypeOf(execaSync('unicorns', [])).toBe<SyncResult<{}>>();
14expectTypeOf(execaSync('unicorns', ['foo'])).toBe<SyncResult<{}>>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 15–17why, one step back
15expectError(execaSync('unicorns', 'foo'));
16expectError(execaSync('unicorns', [true]));17

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

lines 18–19why, one step back
18expectTypeOf(execaSync('unicorns', {})).toBe<SyncResult<{}>>();
19expectTypeOf(execaSync('unicorns', [], {})).toBe<SyncResult<{}>>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 20–22why, one step back
20expectError(execaSync('unicorns', [], []));
21expectError(execaSync('unicorns', {other: true}));22

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

lines 23–25why, one step back
23expectTypeOf(execaSync`unicorns`).toBe<SyncResult<{}>>();
24expectTypeOf(execaSync('unicorns')).toBe<SyncResult<{}>>();25expectTypeOf(execaSync`unicorns`).toBe<SyncResult<{}>>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 26why, one step back
26

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

lines 27–29why, one step back
27expectTypeOf(execaSync({})).toBeAssignableTo<typeof execaSync>();
28expectTypeOf(execaSync({})('unicorns')).toBe<SyncResult<{}>>();29expectTypeOf(execaSync({})`unicorns`).toBe<SyncResult<{}>>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 30why, one step back
30

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

lines 31–42why, one step back
31expectTypeOf(execaSync('unicorns')).toBeAssignableTo<{stdout: string}>();
32expectTypeOf(execaSync('unicorns', {encoding: 'buffer'})).toBeAssignableTo<{stdout: Uint8Array}>();33expectTypeOf(execaSync('unicorns', ['foo'])).toBeAssignableTo<{stdout: string}>();34expectTypeOf(execaSync('unicorns', ['foo'], {encoding: 'buffer'})).toBeAssignableTo<{stdout: Uint8Array}>();35expectTypeOf(execaSync({})('unicorns')).toBeAssignableTo<{stdout: string}>();36expectTypeOf(execaSync({encoding: 'buffer'})('unicorns')).toBeAssignableTo<{stdout: Uint8Array}>();37expectTypeOf(execaSync({})({encoding: 'buffer'})('unicorns')).toBeAssignableTo<{stdout: Uint8Array}>();38expectTypeOf(execaSync({encoding: 'buffer'})({})('unicorns')).toBeAssignableTo<{stdout: Uint8Array}>();39expectTypeOf(execaSync({})`unicorns`).toBeAssignableTo<{stdout: string}>();40expectTypeOf(execaSync({encoding: 'buffer'})`unicorns`).toBeAssignableTo<{stdout: Uint8Array}>();41expectTypeOf(execaSync({})({encoding: 'buffer'})`unicorns`).toBeAssignableTo<{stdout: Uint8Array}>();42expectTypeOf(execaSync({encoding: 'buffer'})({})`unicorns`).toBeAssignableTo<{stdout: Uint8Array}>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 43why, one step back
43

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

lines 44–50why, one step back
44expectTypeOf(execaSync`${'unicorns'}`).toBe<SyncResult<{}>>();
45expectTypeOf(execaSync`unicorns ${'foo'}`).toBe<SyncResult<{}>>();46expectTypeOf(execaSync`unicorns ${'foo'} ${'bar'}`).toBe<SyncResult<{}>>();47expectTypeOf(execaSync`unicorns ${1}`).toBe<SyncResult<{}>>();48expectTypeOf(execaSync`unicorns ${stringArray}`).toBe<SyncResult<{}>>();49expectTypeOf(execaSync`unicorns ${[1, 2]}`).toBe<SyncResult<{}>>();50expectTypeOf(execaSync`unicorns ${false.toString()}`).toBe<SyncResult<{}>>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 51–52why, one step back
51expectError(execaSync`unicorns ${false}`);
52

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

lines 53–55why, one step back
53expectTypeOf(execaSync`unicorns ${execaSync`echo foo`}`).toBe<SyncResult<{}>>();
54expectTypeOf(execaSync`unicorns ${execaSync({reject: false})`echo foo`}`).toBe<SyncResult<{}>>();55expectTypeOf(execaSync`unicorns ${[execaSync`echo foo`, 'bar']}`).toBe<SyncResult<{}>>();