readable-stream.test-d.ts
This file
Path
test-d/stdio/option/readable-stream.test-d.ts
43 lines · 2.1 KiB · TypeScript
Last changed by
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
History of this fileTake it
1234567891011121314151617181920212223242526272829303132333435363738394041424344import {ReadableStream} from 'node:stream/web';import {expectTypeOf, expectError} from 'nz';import { execa, execaSync, type StdinOption, type StdinSyncOption, type StdoutStderrOption, type StdoutStderrSyncOption,} from '../../../index.js';
await execa('unicorns', {stdin: new ReadableStream()});expectError(execaSync('unicorns', {stdin: new ReadableStream()}));await execa('unicorns', {stdin: [new ReadableStream()]});expectError(execaSync('unicorns', {stdin: [new ReadableStream()]}));
expectError(await execa('unicorns', {stdout: new ReadableStream()}));expectError(execaSync('unicorns', {stdout: new ReadableStream()}));expectError(await execa('unicorns', {stdout: [new ReadableStream()]}));expectError(execaSync('unicorns', {stdout: [new ReadableStream()]}));
expectError(await execa('unicorns', {stderr: new ReadableStream()}));expectError(execaSync('unicorns', {stderr: new ReadableStream()}));expectError(await execa('unicorns', {stderr: [new ReadableStream()]}));expectError(execaSync('unicorns', {stderr: [new ReadableStream()]}));
expectError(await execa('unicorns', {stdio: new ReadableStream()}));expectError(execaSync('unicorns', {stdio: new ReadableStream()}));
await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', new ReadableStream()]});expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', new ReadableStream()]}));await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [new ReadableStream()]]});expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [new ReadableStream()]]}));
expectTypeOf(new ReadableStream()).toBeAssignableTo<StdinOption>();expectTypeOf(new ReadableStream()).not.toBeAssignableTo<StdinSyncOption>();[new ReadableStream()] satisfies StdinOption;expectTypeOf([new ReadableStream()]).not.toBeAssignableTo<StdinSyncOption>();
expectTypeOf(new ReadableStream()).not.toBeAssignableTo<StdoutStderrOption>();expectTypeOf(new ReadableStream()).not.toBeAssignableTo<StdoutStderrSyncOption>();expectTypeOf([new ReadableStream()]).not.toBeAssignableTo<StdoutStderrOption>();expectTypeOf([new ReadableStream()]).not.toBeAssignableTo<StdoutStderrSyncOption>();