web-transform-object.test-d.ts
This file
Path
test-d/stdio/option/web-transform-object.test-d.ts
48 lines · 2.1 KiB · TypeScript
Last changed by
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
History of this fileTake it
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import {TransformStream} from 'node:stream/web';import {expectTypeOf, expectError} from 'nz';import { execa, execaSync, type StdinOption, type StdinSyncOption, type StdoutStderrOption, type StdoutStderrSyncOption,} from '../../../index.js';
const webTransformObject = { transform: new TransformStream(), objectMode: true as const,} as const;
await execa('unicorns', {stdin: webTransformObject});expectError(execaSync('unicorns', {stdin: webTransformObject}));await execa('unicorns', {stdin: [webTransformObject]});expectError(execaSync('unicorns', {stdin: [webTransformObject]}));
await execa('unicorns', {stdout: webTransformObject});expectError(execaSync('unicorns', {stdout: webTransformObject}));await execa('unicorns', {stdout: [webTransformObject]});expectError(execaSync('unicorns', {stdout: [webTransformObject]}));
await execa('unicorns', {stderr: webTransformObject});expectError(execaSync('unicorns', {stderr: webTransformObject}));await execa('unicorns', {stderr: [webTransformObject]});expectError(execaSync('unicorns', {stderr: [webTransformObject]}));
expectError(await execa('unicorns', {stdio: webTransformObject}));expectError(execaSync('unicorns', {stdio: webTransformObject}));
await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', webTransformObject]});expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', webTransformObject]}));await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [webTransformObject]]});expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [webTransformObject]]}));
expectTypeOf(webTransformObject).toBeAssignableTo<StdinOption>();expectTypeOf(webTransformObject).not.toBeAssignableTo<StdinSyncOption>();[webTransformObject] satisfies StdinOption;expectTypeOf([webTransformObject]).not.toBeAssignableTo<StdinSyncOption>();
expectTypeOf(webTransformObject).toBeAssignableTo<StdoutStderrOption>();expectTypeOf(webTransformObject).not.toBeAssignableTo<StdoutStderrSyncOption>();[webTransformObject] satisfies StdoutStderrOption;expectTypeOf([webTransformObject]).not.toBeAssignableTo<StdoutStderrSyncOption>();