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