Skip to content
Myr

main-async.test-d.ts

This file

Path

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

57 lines · 3.3 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 {execa, type Result, type ResultPromise} from '../../index.js';
34const fileUrl = new URL('file:///test');5const stringArray = ['foo', 'bar'] as const;67expectError(execa());8expectError(execa(true));9expectError(execa(['unicorns', 'arg']));

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

lines 10–11why, one step back
10expectTypeOf(execa('unicorns')).toBeAssignableTo<ResultPromise>();
11expectTypeOf(execa(fileUrl)).toBeAssignableTo<ResultPromise>();

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(execa('unicorns', [])).toBeAssignableTo<ResultPromise>();
14expectTypeOf(execa('unicorns', ['foo'])).toBeAssignableTo<ResultPromise>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

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

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

lines 18–19why, one step back
18expectTypeOf(execa('unicorns', {})).toBeAssignableTo<ResultPromise>();
19expectTypeOf(execa('unicorns', [], {})).toBeAssignableTo<ResultPromise>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

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

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

lines 23–25why, one step back
23expectTypeOf(execa`unicorns`).toBeAssignableTo<ResultPromise>();
24expectTypeOf(await execa('unicorns')).toBe<Result<{}>>();25expectTypeOf(await execa`unicorns`).toBe<Result<{}>>();

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(execa({})).toBeAssignableTo<typeof execa>();
28expectTypeOf(execa({})('unicorns')).toBeAssignableTo<ResultPromise>();29expectTypeOf(execa({})`unicorns`).toBeAssignableTo<ResultPromise>();

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(await execa('unicorns')).toBeAssignableTo<{stdout: string}>();
32expectTypeOf(await execa('unicorns', {encoding: 'buffer'})).toBeAssignableTo<{stdout: Uint8Array}>();33expectTypeOf(await execa('unicorns', ['foo'])).toBeAssignableTo<{stdout: string}>();34expectTypeOf(await execa('unicorns', ['foo'], {encoding: 'buffer'})).toBeAssignableTo<{stdout: Uint8Array}>();35expectTypeOf(await execa({})('unicorns')).toBeAssignableTo<{stdout: string}>();36expectTypeOf(await execa({encoding: 'buffer'})('unicorns')).toBeAssignableTo<{stdout: Uint8Array}>();37expectTypeOf(await execa({})({encoding: 'buffer'})('unicorns')).toBeAssignableTo<{stdout: Uint8Array}>();38expectTypeOf(await execa({encoding: 'buffer'})({})('unicorns')).toBeAssignableTo<{stdout: Uint8Array}>();39expectTypeOf(await execa({})`unicorns`).toBeAssignableTo<{stdout: string}>();40expectTypeOf(await execa({encoding: 'buffer'})`unicorns`).toBeAssignableTo<{stdout: Uint8Array}>();41expectTypeOf(await execa({})({encoding: 'buffer'})`unicorns`).toBeAssignableTo<{stdout: Uint8Array}>();42expectTypeOf(await execa({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(await execa`${'unicorns'}`).toBe<Result<{}>>();
45expectTypeOf(await execa`unicorns ${'foo'}`).toBe<Result<{}>>();46expectTypeOf(await execa`unicorns ${'foo'} ${'bar'}`).toBe<Result<{}>>();47expectTypeOf(await execa`unicorns ${1}`).toBe<Result<{}>>();48expectTypeOf(await execa`unicorns ${stringArray}`).toBe<Result<{}>>();49expectTypeOf(await execa`unicorns ${[1, 2]}`).toBe<Result<{}>>();50expectTypeOf(await execa`unicorns ${false.toString()}`).toBe<Result<{}>>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

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

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

lines 53–54why, one step back
53expectTypeOf(await execa`unicorns ${await execa`echo foo`}`).toBe<Result<{}>>();
54expectTypeOf(await execa`unicorns ${await execa({reject: false})`echo foo`}`).toBe<Result<{}>>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 55why, one step back
55expectError(await execa`unicorns ${execa`echo foo`}`);

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

line 56why, one step back
56expectTypeOf(await execa`unicorns ${[await execa`echo foo`, 'bar']}`).toBe<Result<{}>>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 57why, one step back
57expectError(await execa`unicorns ${[execa`echo foo`, 'bar']}`);