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 fileTake 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 back1import {expectTypeOf, expectError} from 'nz';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 2–37why, one step back2import {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]]}));37Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 38–41why, one step back38expectTypeOf(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 back42Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 43–46why, one step back43expectTypeOf(asyncGenerator).toBeAssignableTo<StdoutStderrOption>();44expectTypeOf(asyncGenerator).not.toBeAssignableTo<StdoutStderrSyncOption>();45[asyncGenerator] satisfies StdoutStderrOption;46expectTypeOf([asyncGenerator]).not.toBeAssignableTo<StdoutStderrSyncOption>();