specific.test-d.ts
This file
Path
test-d/arguments/specific.test-d.ts
169 lines · 9.3 KiB · TypeScript
Last changed by
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
History of this fileTake it
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170import {expectTypeOf, expectError} from 'nz';import {execa, execaSync} from '../../index.js';
await execa('unicorns', {maxBuffer: {}});expectError(await execa('unicorns', {maxBuffer: []}));await execa('unicorns', {maxBuffer: {stdout: 0}});await execa('unicorns', {maxBuffer: {stderr: 0}});await execa('unicorns', {maxBuffer: {stdout: 0, stderr: 0} as const});await execa('unicorns', {maxBuffer: {all: 0}});await execa('unicorns', {maxBuffer: {fd1: 0}});await execa('unicorns', {maxBuffer: {fd2: 0}});await execa('unicorns', {maxBuffer: {fd3: 0}});await execa('unicorns', {maxBuffer: {fd3: 0}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});await execa('unicorns', {maxBuffer: {ipc: 0}});expectError(await execa('unicorns', {maxBuffer: {stdout: '0'}}));
execaSync('unicorns', {maxBuffer: {}});expectError(execaSync('unicorns', {maxBuffer: []}));execaSync('unicorns', {maxBuffer: {stdout: 0}});execaSync('unicorns', {maxBuffer: {stderr: 0}});execaSync('unicorns', {maxBuffer: {stdout: 0, stderr: 0} as const});execaSync('unicorns', {maxBuffer: {all: 0}});execaSync('unicorns', {maxBuffer: {fd1: 0}});execaSync('unicorns', {maxBuffer: {fd2: 0}});execaSync('unicorns', {maxBuffer: {fd3: 0}});execaSync('unicorns', {maxBuffer: {fd3: 0}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});execaSync('unicorns', {maxBuffer: {ipc: 0}});expectError(execaSync('unicorns', {maxBuffer: {stdout: '0'}}));
await execa('unicorns', {verbose: {}});expectError(await execa('unicorns', {verbose: []}));await execa('unicorns', {verbose: {stdout: 'none'}});await execa('unicorns', {verbose: {stderr: 'none'}});await execa('unicorns', {verbose: {stdout: 'none', stderr: 'none'} as const});await execa('unicorns', {verbose: {all: 'none'}});await execa('unicorns', {verbose: {fd1: 'none'}});await execa('unicorns', {verbose: {fd2: 'none'}});await execa('unicorns', {verbose: {fd3: 'none'}});await execa('unicorns', {verbose: {fd3: 'none'}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});await execa('unicorns', {verbose: {ipc: 'none'}});expectError(await execa('unicorns', {verbose: {stdout: 'other'}}));
execaSync('unicorns', {verbose: {}});expectError(execaSync('unicorns', {verbose: []}));execaSync('unicorns', {verbose: {stdout: 'none'}});execaSync('unicorns', {verbose: {stderr: 'none'}});execaSync('unicorns', {verbose: {stdout: 'none', stderr: 'none'} as const});execaSync('unicorns', {verbose: {all: 'none'}});execaSync('unicorns', {verbose: {fd1: 'none'}});execaSync('unicorns', {verbose: {fd2: 'none'}});execaSync('unicorns', {verbose: {fd3: 'none'}});execaSync('unicorns', {verbose: {fd3: 'none'}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});execaSync('unicorns', {verbose: {ipc: 'none'}});expectError(execaSync('unicorns', {verbose: {stdout: 'other'}}));
await execa('unicorns', {stripFinalNewline: {}});expectError(await execa('unicorns', {stripFinalNewline: []}));await execa('unicorns', {stripFinalNewline: {stdout: true}});await execa('unicorns', {stripFinalNewline: {stderr: true}});await execa('unicorns', {stripFinalNewline: {stdout: true, stderr: true} as const});await execa('unicorns', {stripFinalNewline: {all: true}});await execa('unicorns', {stripFinalNewline: {fd1: true}});await execa('unicorns', {stripFinalNewline: {fd2: true}});await execa('unicorns', {stripFinalNewline: {fd3: true}});await execa('unicorns', {stripFinalNewline: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});await execa('unicorns', {stripFinalNewline: {ipc: true}});expectError(await execa('unicorns', {stripFinalNewline: {stdout: 'true'}}));
execaSync('unicorns', {stripFinalNewline: {}});expectError(execaSync('unicorns', {stripFinalNewline: []}));execaSync('unicorns', {stripFinalNewline: {stdout: true}});execaSync('unicorns', {stripFinalNewline: {stderr: true}});execaSync('unicorns', {stripFinalNewline: {stdout: true, stderr: true} as const});execaSync('unicorns', {stripFinalNewline: {all: true}});execaSync('unicorns', {stripFinalNewline: {fd1: true}});execaSync('unicorns', {stripFinalNewline: {fd2: true}});execaSync('unicorns', {stripFinalNewline: {fd3: true}});execaSync('unicorns', {stripFinalNewline: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});execaSync('unicorns', {stripFinalNewline: {ipc: true}});expectError(execaSync('unicorns', {stripFinalNewline: {stdout: 'true'}}));
await execa('unicorns', {lines: {}});expectError(await execa('unicorns', {lines: []}));await execa('unicorns', {lines: {stdout: true}});await execa('unicorns', {lines: {stderr: true}});await execa('unicorns', {lines: {stdout: true, stderr: true} as const});await execa('unicorns', {lines: {all: true}});await execa('unicorns', {lines: {fd1: true}});await execa('unicorns', {lines: {fd2: true}});await execa('unicorns', {lines: {fd3: true}});await execa('unicorns', {lines: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});await execa('unicorns', {lines: {ipc: true}});expectError(await execa('unicorns', {lines: {stdout: 'true'}}));
execaSync('unicorns', {lines: {}});expectError(execaSync('unicorns', {lines: []}));execaSync('unicorns', {lines: {stdout: true}});execaSync('unicorns', {lines: {stderr: true}});execaSync('unicorns', {lines: {stdout: true, stderr: true} as const});execaSync('unicorns', {lines: {all: true}});execaSync('unicorns', {lines: {fd1: true}});execaSync('unicorns', {lines: {fd2: true}});execaSync('unicorns', {lines: {fd3: true}});execaSync('unicorns', {lines: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});execaSync('unicorns', {lines: {ipc: true}});expectError(execaSync('unicorns', {lines: {stdout: 'true'}}));
await execa('unicorns', {buffer: {}});expectError(await execa('unicorns', {buffer: []}));await execa('unicorns', {buffer: {stdout: true}});await execa('unicorns', {buffer: {stderr: true}});await execa('unicorns', {buffer: {stdout: true, stderr: true} as const});await execa('unicorns', {buffer: {all: true}});await execa('unicorns', {buffer: {fd1: true}});await execa('unicorns', {buffer: {fd2: true}});await execa('unicorns', {buffer: {fd3: true}});await execa('unicorns', {buffer: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});await execa('unicorns', {buffer: {ipc: true}});expectError(await execa('unicorns', {buffer: {stdout: 'true'}}));
execaSync('unicorns', {buffer: {}});expectError(execaSync('unicorns', {buffer: []}));execaSync('unicorns', {buffer: {stdout: true}});execaSync('unicorns', {buffer: {stderr: true}});execaSync('unicorns', {buffer: {stdout: true, stderr: true} as const});execaSync('unicorns', {buffer: {all: true}});execaSync('unicorns', {buffer: {fd1: true}});execaSync('unicorns', {buffer: {fd2: true}});execaSync('unicorns', {buffer: {fd3: true}});execaSync('unicorns', {buffer: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});execaSync('unicorns', {buffer: {ipc: true}});expectError(execaSync('unicorns', {buffer: {stdout: 'true'}}));
expectError(await execa('unicorns', {preferLocal: {}}));expectError(await execa('unicorns', {preferLocal: []}));expectError(await execa('unicorns', {preferLocal: {stdout: 0}}));expectError(await execa('unicorns', {preferLocal: {stderr: 0}}));expectError(await execa('unicorns', {preferLocal: {stdout: 0, stderr: 0} as const}));expectError(await execa('unicorns', {preferLocal: {all: 0}}));expectError(await execa('unicorns', {preferLocal: {fd1: 0}}));expectError(await execa('unicorns', {preferLocal: {fd2: 0}}));expectError(await execa('unicorns', {preferLocal: {fd3: 0}}));expectError(await execa('unicorns', {preferLocal: {ipc: 0}}));expectError(await execa('unicorns', {preferLocal: {stdout: '0'}}));
expectError(execaSync('unicorns', {preferLocal: {}}));expectError(execaSync('unicorns', {preferLocal: []}));expectError(execaSync('unicorns', {preferLocal: {stdout: 0}}));expectError(execaSync('unicorns', {preferLocal: {stderr: 0}}));expectError(execaSync('unicorns', {preferLocal: {stdout: 0, stderr: 0} as const}));expectError(execaSync('unicorns', {preferLocal: {all: 0}}));expectError(execaSync('unicorns', {preferLocal: {fd1: 0}}));expectError(execaSync('unicorns', {preferLocal: {fd2: 0}}));expectError(execaSync('unicorns', {preferLocal: {fd3: 0}}));expectError(execaSync('unicorns', {preferLocal: {ipc: 0}}));expectError(execaSync('unicorns', {preferLocal: {stdout: '0'}}));
expectTypeOf(execaSync('unicorns', {lines: {stdout: true, fd1: false}}).stdout).toBe<string[]>();expectTypeOf(execaSync('unicorns', {lines: {stdout: true, all: false}}).stdout).toBe<string[]>();expectTypeOf(execaSync('unicorns', {lines: {fd1: true, all: false}}).stdout).toBe<string[]>();expectTypeOf(execaSync('unicorns', {lines: {stderr: true, fd2: false}}).stderr).toBe<string[]>();expectTypeOf(execaSync('unicorns', {lines: {stderr: true, all: false}}).stderr).toBe<string[]>();expectTypeOf(execaSync('unicorns', {lines: {fd2: true, all: false}}).stderr).toBe<string[]>();expectTypeOf(execaSync('unicorns', {lines: {fd1: false, stdout: true}}).stdout).toBe<string[]>();expectTypeOf(execaSync('unicorns', {lines: {all: false, stdout: true}}).stdout).toBe<string[]>();expectTypeOf(execaSync('unicorns', {lines: {all: false, fd1: true}}).stdout).toBe<string[]>();expectTypeOf(execaSync('unicorns', {lines: {fd2: false, stderr: true}}).stderr).toBe<string[]>();expectTypeOf(execaSync('unicorns', {lines: {all: false, stderr: true}}).stderr).toBe<string[]>();expectTypeOf(execaSync('unicorns', {lines: {all: false, fd2: true}}).stderr).toBe<string[]>();