iterable-binary.test-d.ts
This file
Path
test-d/stdio/option/iterable-binary.test-d.ts
48 lines · 2.0 KiB · TypeScript
Last changed by
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
History of this fileTake it
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import {expectTypeOf, expectError} from 'nz';import { execa, execaSync, type StdinOption, type StdinSyncOption, type StdoutStderrOption, type StdoutStderrSyncOption,} from '../../../index.js';
const binaryIterableFunction = function * () { yield new Uint8Array(0);};
const binaryIterable = binaryIterableFunction();
await execa('unicorns', {stdin: binaryIterable});execaSync('unicorns', {stdin: binaryIterable});await execa('unicorns', {stdin: [binaryIterable]});execaSync('unicorns', {stdin: [binaryIterable]});
expectError(await execa('unicorns', {stdout: binaryIterable}));expectError(execaSync('unicorns', {stdout: binaryIterable}));expectError(await execa('unicorns', {stdout: [binaryIterable]}));expectError(execaSync('unicorns', {stdout: [binaryIterable]}));
expectError(await execa('unicorns', {stderr: binaryIterable}));expectError(execaSync('unicorns', {stderr: binaryIterable}));expectError(await execa('unicorns', {stderr: [binaryIterable]}));expectError(execaSync('unicorns', {stderr: [binaryIterable]}));
expectError(await execa('unicorns', {stdio: binaryIterable}));expectError(execaSync('unicorns', {stdio: binaryIterable}));
await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', binaryIterable]});expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', binaryIterable]}));await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [binaryIterable]]});expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [binaryIterable]]}));
expectTypeOf(binaryIterable).toBeAssignableTo<StdinOption>();expectTypeOf(binaryIterable).toBeAssignableTo<StdinSyncOption>();[binaryIterable] satisfies StdinOption;[binaryIterable] satisfies StdinSyncOption;
expectTypeOf(binaryIterable).not.toBeAssignableTo<StdoutStderrOption>();expectTypeOf(binaryIterable).not.toBeAssignableTo<StdoutStderrSyncOption>();expectTypeOf([binaryIterable]).not.toBeAssignableTo<StdoutStderrOption>();expectTypeOf([binaryIterable]).not.toBeAssignableTo<StdoutStderrSyncOption>();