Skip to content
Myr

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 file

Take it

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

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

Allow appending to files (#1166)ehmickybefore adoption94a75df

lines 2–35why, one step back
2import {
3 execa,4 execaSync,5 type StdinOption,6 type StdinSyncOption,7 type StdoutStderrOption,8 type StdoutStderrSyncOption,9} from '../../../index.js';1011const fileAppend = {file: './test', append: true} as const;1213await execa('unicorns', {stdin: fileAppend});14execaSync('unicorns', {stdin: fileAppend});15await execa('unicorns', {stdin: [fileAppend]});16execaSync('unicorns', {stdin: [fileAppend]});1718await execa('unicorns', {stdout: fileAppend});19execaSync('unicorns', {stdout: fileAppend});20await execa('unicorns', {stdout: [fileAppend]});21execaSync('unicorns', {stdout: [fileAppend]});2223await execa('unicorns', {stderr: fileAppend});24execaSync('unicorns', {stderr: fileAppend});25await execa('unicorns', {stderr: [fileAppend]});26execaSync('unicorns', {stderr: [fileAppend]});2728expectError(await execa('unicorns', {stdio: fileAppend}));29expectError(execaSync('unicorns', {stdio: fileAppend}));3031await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', fileAppend]});32execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', fileAppend]});33await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [fileAppend]]});34execaSync('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [fileAppend]]});35

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

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

Allow appending to files (#1166)ehmickybefore adoption94a75df

line 40why, one step back
40

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

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