file-append.test-d.ts
This file
Path
test-d/stdio/option/file-append.test-d.ts
44 lines · 1.6 KiB · TypeScript
Last changed by
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
History of this fileTake it
123456789101112131415161718192021222324252627282930313233343536373839404142434445import {expectTypeOf, expectError} from 'nz';import { execa, execaSync, type StdinOption, type StdinSyncOption, type StdoutStderrOption, type StdoutStderrSyncOption,} from '../../../index.js';
const fileAppend = {file: './test', append: true} as const;
await execa('unicorns', {stdin: fileAppend});execaSync('unicorns', {stdin: fileAppend});await execa('unicorns', {stdin: [fileAppend]});execaSync('unicorns', {stdin: [fileAppend]});
await execa('unicorns', {stdout: fileAppend});execaSync('unicorns', {stdout: fileAppend});await execa('unicorns', {stdout: [fileAppend]});execaSync('unicorns', {stdout: [fileAppend]});
await execa('unicorns', {stderr: fileAppend});execaSync('unicorns', {stderr: fileAppend});await execa('unicorns', {stderr: [fileAppend]});execaSync('unicorns', {stderr: [fileAppend]});
expectError(await execa('unicorns', {stdio: fileAppend}));expectError(execaSync('unicorns', {stdio: fileAppend}));
await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', fileAppend]});execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', fileAppend]});await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [fileAppend]]});execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [fileAppend]]});
expectTypeOf(fileAppend).toBeAssignableTo<StdinOption>();expectTypeOf(fileAppend).toBeAssignableTo<StdinSyncOption>();[fileAppend] satisfies StdinOption;[fileAppend] satisfies StdinSyncOption;
expectTypeOf(fileAppend).toBeAssignableTo<StdoutStderrOption>();expectTypeOf(fileAppend).toBeAssignableTo<StdoutStderrSyncOption>();[fileAppend] satisfies StdoutStderrOption;[fileAppend] satisfies StdoutStderrSyncOption;