readable-stream.test-d.ts
This file
Path
test-d/convert/readable-stream.test-d.ts
26 lines · 1.0 KiB · TypeScript
Last changed by
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
History of this fileTake it
123456789101112131415161718192021222324252627import type {ReadableStream} from 'node:stream/web';import {expectTypeOf, expectError} from 'nz';import {execa} from '../../index.js';
const subprocess = execa('unicorns');
expectTypeOf(subprocess.readableStream()).toBe<ReadableStream>();
subprocess.readableStream({from: 'stdout'});subprocess.readableStream({from: 'stderr'});subprocess.readableStream({from: 'all'});subprocess.readableStream({from: 'fd3'});expectError(subprocess.readableStream({from: 'fd3' as string}));expectError(subprocess.readableStream({from: 'stdin'}));expectError(subprocess.readableStream({from: 'fd'}));expectError(subprocess.readableStream({from: 'fdNotANumber'}));expectError(subprocess.readableStream({to: 'stdin'}));
subprocess.readableStream({binary: false});expectError(subprocess.readableStream({binary: 'false'}));
subprocess.readableStream({preserveNewlines: false});expectError(subprocess.readableStream({preserveNewlines: 'false'}));
expectError(subprocess.readableStream('stdout'));expectError(subprocess.readableStream({other: 'stdout'}));