Skip to content
Myr

generator-object.test-d.ts

This file

Path

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

46 lines · 1.8 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 objectGenerator = function * (line: unknown) {12 yield JSON.parse(line as string) as object;13};1415await execa('unicorns', {stdin: objectGenerator});16execaSync('unicorns', {stdin: objectGenerator});17await execa('unicorns', {stdin: [objectGenerator]});18execaSync('unicorns', {stdin: [objectGenerator]});1920await execa('unicorns', {stdout: objectGenerator});21execaSync('unicorns', {stdout: objectGenerator});22await execa('unicorns', {stdout: [objectGenerator]});23execaSync('unicorns', {stdout: [objectGenerator]});2425await execa('unicorns', {stderr: objectGenerator});26execaSync('unicorns', {stderr: objectGenerator});27await execa('unicorns', {stderr: [objectGenerator]});28execaSync('unicorns', {stderr: [objectGenerator]});2930expectError(await execa('unicorns', {stdio: objectGenerator}));31expectError(execaSync('unicorns', {stdio: objectGenerator}));3233await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', objectGenerator]});34execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', objectGenerator]});35await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [objectGenerator]]});36execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [objectGenerator]]});37

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

lines 38–41why, one step back
38expectTypeOf(objectGenerator).toBeAssignableTo<StdinOption>();
39expectTypeOf(objectGenerator).toBeAssignableTo<StdinSyncOption>();40[objectGenerator] satisfies StdinOption;41[objectGenerator] satisfies 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(objectGenerator).toBeAssignableTo<StdoutStderrOption>();
44expectTypeOf(objectGenerator).toBeAssignableTo<StdoutStderrSyncOption>();45[objectGenerator] satisfies StdoutStderrOption;46[objectGenerator] satisfies StdoutStderrSyncOption;