writable.test-d.ts
This file
Path
test-d/convert/writable.test-d.ts
25 lines · 919 bytes · TypeScript
Last changed by
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
History of this fileTake it
1234567891011121314151617181920212223242526import type {Writable} from 'node:stream';import {expectTypeOf, expectError} from 'nz';import {execa} from '../../index.js';
const subprocess = execa('unicorns');
expectTypeOf(subprocess.writable()).toBe<Writable>();
subprocess.writable({to: 'stdin'});subprocess.writable({to: 'fd3'});expectError(subprocess.writable({to: 'fd3' as string}));expectError(subprocess.writable({to: 'stdout'}));expectError(subprocess.writable({to: 'fd'}));expectError(subprocess.writable({to: 'fdNotANumber'}));expectError(subprocess.writable({from: 'stdout'}));
expectError(subprocess.writable({binary: false}));
expectError(subprocess.writable({preserveNewlines: false}));
expectError(subprocess.writable('stdin'));expectError(subprocess.writable({other: 'stdin'}));
const inputPipeSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe', input: true}]});inputPipeSubprocess.writable({to: 'fd3'});