Skip to content
Myr

generator-async.test-d.ts

This file

Path

test-d/stdio/option/generator-async.test-d.ts

46 lines · 1.9 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–37why, one step back
2import {
3 execa,4 execaSync,5 type StdinOption,6 type StdinSyncOption,7 type StdoutStderrOption,8 type StdoutStderrSyncOption,9} from '../../../index.js';1011const asyncGenerator = async function * (line: unknown) {12 yield '';13};1415await execa('unicorns', {stdin: asyncGenerator});16expectError(execaSync('unicorns', {stdin: asyncGenerator}));17await execa('unicorns', {stdin: [asyncGenerator]});18expectError(execaSync('unicorns', {stdin: [asyncGenerator]}));1920await execa('unicorns', {stdout: asyncGenerator});21expectError(execaSync('unicorns', {stdout: asyncGenerator}));22await execa('unicorns', {stdout: [asyncGenerator]});23expectError(execaSync('unicorns', {stdout: [asyncGenerator]}));2425await execa('unicorns', {stderr: asyncGenerator});26expectError(execaSync('unicorns', {stderr: asyncGenerator}));27await execa('unicorns', {stderr: [asyncGenerator]});28expectError(execaSync('unicorns', {stderr: [asyncGenerator]}));2930expectError(await execa('unicorns', {stdio: asyncGenerator}));31expectError(execaSync('unicorns', {stdio: asyncGenerator}));3233await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', asyncGenerator]});34expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', asyncGenerator]}));35await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [asyncGenerator]]});36expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [asyncGenerator]]}));37

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

lines 38–41why, one step back
38expectTypeOf(asyncGenerator).toBeAssignableTo<StdinOption>();
39expectTypeOf(asyncGenerator).not.toBeAssignableTo<StdinSyncOption>();40[asyncGenerator] satisfies StdinOption;41expectTypeOf([asyncGenerator]).not.toBeAssignableTo<StdinSyncOption>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 42why, one step back
42

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

lines 43–46why, one step back
43expectTypeOf(asyncGenerator).toBeAssignableTo<StdoutStderrOption>();
44expectTypeOf(asyncGenerator).not.toBeAssignableTo<StdoutStderrSyncOption>();45[asyncGenerator] satisfies StdoutStderrOption;46expectTypeOf([asyncGenerator]).not.toBeAssignableTo<StdoutStderrSyncOption>();