Skip to content
Myr

node.test-d.ts

This file

Path

test-d/methods/node.test-d.ts

63 lines · 3.6 KiB · TypeScript

Last changed by

Rename some types (#1009)ehmickybefore adoption2ef9186

History of this file

Take it

Upgrade xo (#980)ehmickybefore adoptionccfa412

line 1why, one step back
1import {expectType, expectError, expectAssignable} from 'tsd';

Rename some types (#1009)ehmickybefore adoption2ef9186

line 2why, one step back
2import {execaNode, type Result, type ResultPromise} from '../../index.js';

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 3–9why, one step back
3
4const fileUrl = new URL('file:///test');5const stringArray = ['foo', 'bar'] as const;67expectError(execaNode());8expectError(execaNode(true));9expectError(execaNode(['unicorns', 'arg']));

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 10–11why, one step back
10expectAssignable<ResultPromise>(execaNode('unicorns'));
11expectAssignable<ResultPromise>(execaNode(fileUrl));

Split type files (#978)ehmickybefore adoption0bd0f0d

line 12why, one step back
12

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 13–14why, one step back
13expectAssignable<ResultPromise>(execaNode('unicorns', []));
14expectAssignable<ResultPromise>(execaNode('unicorns', ['foo']));

Split type files (#978)ehmickybefore adoption0bd0f0d

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

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 18–19why, one step back
18expectAssignable<ResultPromise>(execaNode('unicorns', {}));
19expectAssignable<ResultPromise>(execaNode('unicorns', [], {}));

Split type files (#978)ehmickybefore adoption0bd0f0d

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

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 23–25why, one step back
23expectAssignable<ResultPromise>(execaNode`unicorns`);
24expectType<Result<{}>>(await execaNode('unicorns'));25expectType<Result<{}>>(await execaNode`unicorns`);

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 26–27why, one step back
26
27expectAssignable<typeof execaNode>(execaNode({}));

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 28–29why, one step back
28expectAssignable<ResultPromise>(execaNode({})('unicorns'));
29expectAssignable<ResultPromise>(execaNode({})`unicorns`);

Split type files (#978)ehmickybefore adoption0bd0f0d

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

Rename some types (#1009)ehmickybefore adoption2ef9186

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

Split type files (#978)ehmickybefore adoption0bd0f0d

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

Rename some types (#1009)ehmickybefore adoption2ef9186

line 53why, one step back
53expectType<Result<{}>>(await execaNode`unicorns ${await execaNode`echo foo`}`);

Split type files (#978)ehmickybefore adoption0bd0f0d

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

Rename some types (#1009)ehmickybefore adoption2ef9186

line 55why, one step back
55expectType<Result<{}>>(await execaNode`unicorns ${[await execaNode`echo foo`, 'bar']}`);

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 56–57why, one step back
56expectError(await execaNode`unicorns ${[execaNode`echo foo`, 'bar']}`);
57

Rename some types (#1009)ehmickybefore adoption2ef9186

lines 58–59why, one step back
58expectAssignable<ResultPromise>(execaNode('unicorns', {nodePath: './node'}));
59expectAssignable<ResultPromise>(execaNode('unicorns', {nodePath: fileUrl}));

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 60–63why, one step back
60expectAssignable<{stdout: string}>(await execaNode('unicorns', {nodeOptions: ['--async-stack-traces']}));
61expectAssignable<{stdout: Uint8Array}>(await execaNode('unicorns', {nodeOptions: ['--async-stack-traces'], encoding: 'buffer'}));62expectAssignable<{stdout: string}>(await execaNode('unicorns', ['foo'], {nodeOptions: ['--async-stack-traces']}));63expectAssignable<{stdout: Uint8Array}>(await execaNode('unicorns', ['foo'], {nodeOptions: ['--async-stack-traces'], encoding: 'buffer'}));