Skip to content
Myr

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 file

Take it

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

line 1why, one step back
1import type {ReadableStream} 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.readableStream()).toBe<ReadableStream>();

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

lines 8–26why, one step back
8
9subprocess.readableStream({from: 'stdout'});10subprocess.readableStream({from: 'stderr'});11subprocess.readableStream({from: 'all'});12subprocess.readableStream({from: 'fd3'});13expectError(subprocess.readableStream({from: 'fd3' as string}));14expectError(subprocess.readableStream({from: 'stdin'}));15expectError(subprocess.readableStream({from: 'fd'}));16expectError(subprocess.readableStream({from: 'fdNotANumber'}));17expectError(subprocess.readableStream({to: 'stdin'}));1819subprocess.readableStream({binary: false});20expectError(subprocess.readableStream({binary: 'false'}));2122subprocess.readableStream({preserveNewlines: false});23expectError(subprocess.readableStream({preserveNewlines: 'false'}));2425expectError(subprocess.readableStream('stdout'));26expectError(subprocess.readableStream({other: 'stdout'}));