iterable.test-d.ts
This file
Path
test-d/convert/iterable.test-d.ts
85 lines · 3.2 KiB · TypeScript
Last changed by
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
History of this fileTake it
The walk stopped after 200 commits: lines older than 9f65b86 point at it.
Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 1why, one step back1import {expectTypeOf, expectError} from 'nz';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 2–9why, one step back2import {execa} from '../../index.js';34const subprocess = execa('unicorns');5const bufferSubprocess = execa('unicorns', {encoding: 'buffer', all: true});6const hexSubprocess = execa('unicorns', {encoding: 'hex', all: true});78const asyncIteration = async () => {9 for await (const line of subprocess) {Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 10why, one step back10 expectTypeOf(line).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 11–13why, one step back11 }1213 for await (const line of subprocess.iterable()) {Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 14why, one step back14 expectTypeOf(line).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 15–17why, one step back15 }1617 for await (const line of subprocess.iterable({binary: false})) {Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 18why, one step back18 expectTypeOf(line).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 19–21why, one step back19 }2021 for await (const line of subprocess.iterable({binary: true})) {Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 22why, one step back22 expectTypeOf(line).toBe<Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 23–25why, one step back23 }2425 for await (const line of subprocess.iterable({} as {binary: boolean})) {Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 26why, one step back26 expectTypeOf(line).toBe<string | Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 27–29why, one step back27 }2829 for await (const line of bufferSubprocess) {Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 30why, one step back30 expectTypeOf(line).toBe<Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 31–33why, one step back31 }3233 for await (const line of bufferSubprocess.iterable()) {Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 34why, one step back34 expectTypeOf(line).toBe<Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 35–37why, one step back35 }3637 for await (const line of bufferSubprocess.iterable({binary: false})) {Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 38why, one step back38 expectTypeOf(line).toBe<Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 39–41why, one step back39 }4041 for await (const line of bufferSubprocess.iterable({binary: true})) {Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 42why, one step back42 expectTypeOf(line).toBe<Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 43–45why, one step back43 }4445 for await (const line of bufferSubprocess.iterable({} as {binary: boolean})) {Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 46why, one step back46 expectTypeOf(line).toBe<Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 47–51why, one step back47 }48};4950await asyncIteration();51Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 52–55why, one step back52expectTypeOf(subprocess.iterable()).toBe<AsyncIterableIterator<string>>();53expectTypeOf(subprocess.iterable({binary: false})).toBe<AsyncIterableIterator<string>>();54expectTypeOf(subprocess.iterable({binary: true})).toBe<AsyncIterableIterator<Uint8Array>>();55expectTypeOf(subprocess.iterable({} as {binary: boolean})).toBe<AsyncIterableIterator<string | Uint8Array>>();100% test coverage (#1018)ehmickybefore adoption9f65b86
line 56why, one step back56Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 57–60why, one step back57expectTypeOf(bufferSubprocess.iterable()).toBe<AsyncIterableIterator<Uint8Array>>();58expectTypeOf(bufferSubprocess.iterable({binary: false})).toBe<AsyncIterableIterator<Uint8Array>>();59expectTypeOf(bufferSubprocess.iterable({binary: true})).toBe<AsyncIterableIterator<Uint8Array>>();60expectTypeOf(bufferSubprocess.iterable({} as {binary: boolean})).toBe<AsyncIterableIterator<Uint8Array>>();100% test coverage (#1018)ehmickybefore adoption9f65b86
line 61why, one step back61Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 62–65why, one step back62expectTypeOf(hexSubprocess.iterable()).toBe<AsyncIterableIterator<Uint8Array>>();63expectTypeOf(hexSubprocess.iterable({binary: false})).toBe<AsyncIterableIterator<Uint8Array>>();64expectTypeOf(hexSubprocess.iterable({binary: true})).toBe<AsyncIterableIterator<Uint8Array>>();65expectTypeOf(hexSubprocess.iterable({} as {binary: boolean})).toBe<AsyncIterableIterator<Uint8Array>>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 66–71why, one step back6667subprocess.iterable({});68subprocess.iterable({from: 'stdout'});69subprocess.iterable({from: 'stderr'});70subprocess.iterable({from: 'all'});71subprocess.iterable({from: 'fd3'});Add more type tests (#1117)ehmickybefore adoption077749d
line 72why, one step back72expectError(subprocess.iterable({from: 'fd3' as string}));100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 73–85why, one step back73expectError(subprocess.iterable({from: 'stdin'}));74expectError(subprocess.iterable({from: 'fd'}));75expectError(subprocess.iterable({from: 'fdNotANumber'}));76expectError(subprocess.iterable({to: 'stdin'}));7778subprocess.iterable({binary: false});79expectError(subprocess.iterable({binary: 'false'}));8081subprocess.iterable({preserveNewlines: false});82expectError(subprocess.iterable({preserveNewlines: 'false'}));8384expectError(subprocess.iterable('stdout'));85expectError(subprocess.iterable({other: 'stdout'}));