Skip to content
Myr

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 file

Take it

Add `.readableStream()`, `.writableStream()` and `.transformStream()` methods (#1254)Sindre Sorhusbefore adoption29d9cfc

line 1why, one step back
1import type {WritableStream} from 'node:stream/web';

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 2why, one step back
2import {expectTypeOf, expectError} from 'nz';

Add `.readableStream()`, `.writableStream()` and `.transformStream()` methods (#1254)Sindre Sorhusbefore adoption29d9cfc

lines 3–6why, one step back
3import {execa} from '../../index.js';
45const subprocess = execa('unicorns');6

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 7why, one step back
7expectTypeOf(subprocess.writableStream()).toBe<WritableStream>();

Add `.readableStream()`, `.writableStream()` and `.transformStream()` methods (#1254)Sindre Sorhusbefore adoption29d9cfc

lines 8–25why, one step back
8
9subprocess.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'});