writable-stream.test-d.ts
This file
Path
test-d/convert/writable-stream.test-d.ts
25 lines · 1013 bytes · TypeScript
Last changed by
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
History of this fileTake it
Add `.readableStream()`, `.writableStream()` and `.transformStream()` methods (#1254)Sindre Sorhusbefore adoption29d9cfc
line 1why, one step back1import type {WritableStream} from 'node:stream/web';Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 2why, one step back2import {expectTypeOf, expectError} from 'nz';Add `.readableStream()`, `.writableStream()` and `.transformStream()` methods (#1254)Sindre Sorhusbefore adoption29d9cfc
lines 3–6why, one step back3import {execa} from '../../index.js';45const subprocess = execa('unicorns');6Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 7why, one step back7expectTypeOf(subprocess.writableStream()).toBe<WritableStream>();Add `.readableStream()`, `.writableStream()` and `.transformStream()` methods (#1254)Sindre Sorhusbefore adoption29d9cfc
lines 8–25why, one step back89subprocess.writableStream({to: 'stdin'});10subprocess.writableStream({to: 'fd3'});11expectError(subprocess.writableStream({to: 'fd3' as string}));12expectError(subprocess.writableStream({to: 'stdout'}));13expectError(subprocess.writableStream({to: 'fd'}));14expectError(subprocess.writableStream({to: 'fdNotANumber'}));15expectError(subprocess.writableStream({from: 'stdout'}));1617expectError(subprocess.writableStream({binary: false}));1819expectError(subprocess.writableStream({preserveNewlines: false}));2021expectError(subprocess.writableStream('stdin'));22expectError(subprocess.writableStream({other: 'stdin'}));2324const inputPipeSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe', input: true}]});25inputPipeSubprocess.writableStream({to: 'fd3'});