transform-stream.test-d.ts
This file
Path
test-d/convert/transform-stream.test-d.ts
32 lines · 1.4 KiB · 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 {ReadableWritablePair} 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.transformStream()).toBe<ReadableWritablePair>();Add `.readableStream()`, `.writableStream()` and `.transformStream()` methods (#1254)Sindre Sorhusbefore adoption29d9cfc
lines 8–32why, one step back89subprocess.transformStream({from: 'stdout'});10subprocess.transformStream({from: 'stderr'});11subprocess.transformStream({from: 'all'});12subprocess.transformStream({from: 'fd3'});13subprocess.transformStream({to: 'fd3'});14subprocess.transformStream({from: 'stdout', to: 'stdin'});15subprocess.transformStream({from: 'stdout', to: 'fd3'});16expectError(subprocess.transformStream({from: 'stdout' as string}));17expectError(subprocess.transformStream({to: 'fd3' as string}));18expectError(subprocess.transformStream({from: 'stdin'}));19expectError(subprocess.transformStream({from: 'stderr', to: 'stdout'}));20expectError(subprocess.transformStream({from: 'fd'}));21expectError(subprocess.transformStream({from: 'fdNotANumber'}));22expectError(subprocess.transformStream({to: 'fd'}));23expectError(subprocess.transformStream({to: 'fdNotANumber'}));2425subprocess.transformStream({binary: false});26expectError(subprocess.transformStream({binary: 'false'}));2728subprocess.transformStream({preserveNewlines: false});29expectError(subprocess.transformStream({preserveNewlines: 'false'}));3031expectError(subprocess.transformStream('stdout'));32expectError(subprocess.transformStream({other: 'stdout'}));