Skip to content
Myr

duplex.test-d.ts

This file

Path

test-d/stdio/option/duplex.test-d.ts

45 lines · 1.7 KiB · TypeScript

Last changed by

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

History of this file

Take it

The walk stopped after 200 commits: lines older than 9f65b86 point at it.

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 1why, one step back
1import {Duplex} from 'node:stream';

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

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

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 3–36why, one step back
3import {
4 execa,5 execaSync,6 type StdinOption,7 type StdinSyncOption,8 type StdoutStderrOption,9 type StdoutStderrSyncOption,10} from '../../../index.js';1112const duplex = {transform: new Duplex()} as const;1314await execa('unicorns', {stdin: duplex});15expectError(execaSync('unicorns', {stdin: duplex}));16await execa('unicorns', {stdin: [duplex]});17expectError(execaSync('unicorns', {stdin: [duplex]}));1819await execa('unicorns', {stdout: duplex});20expectError(execaSync('unicorns', {stdout: duplex}));21await execa('unicorns', {stdout: [duplex]});22expectError(execaSync('unicorns', {stdout: [duplex]}));2324await execa('unicorns', {stderr: duplex});25expectError(execaSync('unicorns', {stderr: duplex}));26await execa('unicorns', {stderr: [duplex]});27expectError(execaSync('unicorns', {stderr: [duplex]}));2829expectError(await execa('unicorns', {stdio: duplex}));30expectError(execaSync('unicorns', {stdio: duplex}));3132await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', duplex]});33expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', duplex]}));34await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [duplex]]});35expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [duplex]]}));36

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

lines 37–40why, one step back
37expectTypeOf(duplex).toBeAssignableTo<StdinOption>();
38expectTypeOf(duplex).not.toBeAssignableTo<StdinSyncOption>();39[duplex] satisfies StdinOption;40expectTypeOf([duplex]).not.toBeAssignableTo<StdinSyncOption>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 41why, one step back
41

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

lines 42–45why, one step back
42expectTypeOf(duplex).toBeAssignableTo<StdoutStderrOption>();
43expectTypeOf(duplex).not.toBeAssignableTo<StdoutStderrSyncOption>();44[duplex] satisfies StdoutStderrOption;45expectTypeOf([duplex]).not.toBeAssignableTo<StdoutStderrSyncOption>();