main-sync.test-d.ts
This file
Path
test-d/methods/main-sync.test-d.ts
55 lines · 3.1 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 {execaSync, type SyncResult} from '../../index.js';34const fileUrl = new URL('file:///test');5const stringArray = ['foo', 'bar'] as const;67expectError(execaSync());8expectError(execaSync(true));9expectError(execaSync(['unicorns', 'arg']));Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 10–11why, one step back10expectTypeOf(execaSync('unicorns')).toBe<SyncResult<{}>>();11expectTypeOf(execaSync(fileUrl)).toBe<SyncResult<{}>>();100% test coverage (#1018)ehmickybefore adoption9f65b86
line 12why, one step back12Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 13–14why, one step back13expectTypeOf(execaSync('unicorns', [])).toBe<SyncResult<{}>>();14expectTypeOf(execaSync('unicorns', ['foo'])).toBe<SyncResult<{}>>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 15–17why, one step back15expectError(execaSync('unicorns', 'foo'));16expectError(execaSync('unicorns', [true]));17Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 18–19why, one step back18expectTypeOf(execaSync('unicorns', {})).toBe<SyncResult<{}>>();19expectTypeOf(execaSync('unicorns', [], {})).toBe<SyncResult<{}>>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 20–22why, one step back20expectError(execaSync('unicorns', [], []));21expectError(execaSync('unicorns', {other: true}));22Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 23–25why, one step back23expectTypeOf(execaSync`unicorns`).toBe<SyncResult<{}>>();24expectTypeOf(execaSync('unicorns')).toBe<SyncResult<{}>>();25expectTypeOf(execaSync`unicorns`).toBe<SyncResult<{}>>();100% test coverage (#1018)ehmickybefore adoption9f65b86
line 26why, one step back26Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 27–29why, one step back27expectTypeOf(execaSync({})).toBeAssignableTo<typeof execaSync>();28expectTypeOf(execaSync({})('unicorns')).toBe<SyncResult<{}>>();29expectTypeOf(execaSync({})`unicorns`).toBe<SyncResult<{}>>();100% test coverage (#1018)ehmickybefore adoption9f65b86
line 30why, one step back30Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 31–42why, one step back31expectTypeOf(execaSync('unicorns')).toBeAssignableTo<{stdout: string}>();32expectTypeOf(execaSync('unicorns', {encoding: 'buffer'})).toBeAssignableTo<{stdout: Uint8Array}>();33expectTypeOf(execaSync('unicorns', ['foo'])).toBeAssignableTo<{stdout: string}>();34expectTypeOf(execaSync('unicorns', ['foo'], {encoding: 'buffer'})).toBeAssignableTo<{stdout: Uint8Array}>();35expectTypeOf(execaSync({})('unicorns')).toBeAssignableTo<{stdout: string}>();36expectTypeOf(execaSync({encoding: 'buffer'})('unicorns')).toBeAssignableTo<{stdout: Uint8Array}>();37expectTypeOf(execaSync({})({encoding: 'buffer'})('unicorns')).toBeAssignableTo<{stdout: Uint8Array}>();38expectTypeOf(execaSync({encoding: 'buffer'})({})('unicorns')).toBeAssignableTo<{stdout: Uint8Array}>();39expectTypeOf(execaSync({})`unicorns`).toBeAssignableTo<{stdout: string}>();40expectTypeOf(execaSync({encoding: 'buffer'})`unicorns`).toBeAssignableTo<{stdout: Uint8Array}>();41expectTypeOf(execaSync({})({encoding: 'buffer'})`unicorns`).toBeAssignableTo<{stdout: Uint8Array}>();42expectTypeOf(execaSync({encoding: 'buffer'})({})`unicorns`).toBeAssignableTo<{stdout: Uint8Array}>();100% test coverage (#1018)ehmickybefore adoption9f65b86
line 43why, one step back43Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 44–50why, one step back44expectTypeOf(execaSync`${'unicorns'}`).toBe<SyncResult<{}>>();45expectTypeOf(execaSync`unicorns ${'foo'}`).toBe<SyncResult<{}>>();46expectTypeOf(execaSync`unicorns ${'foo'} ${'bar'}`).toBe<SyncResult<{}>>();47expectTypeOf(execaSync`unicorns ${1}`).toBe<SyncResult<{}>>();48expectTypeOf(execaSync`unicorns ${stringArray}`).toBe<SyncResult<{}>>();49expectTypeOf(execaSync`unicorns ${[1, 2]}`).toBe<SyncResult<{}>>();50expectTypeOf(execaSync`unicorns ${false.toString()}`).toBe<SyncResult<{}>>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 51–52why, one step back51expectError(execaSync`unicorns ${false}`);52Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 53–55why, one step back53expectTypeOf(execaSync`unicorns ${execaSync`echo foo`}`).toBe<SyncResult<{}>>();54expectTypeOf(execaSync`unicorns ${execaSync({reject: false})`echo foo`}`).toBe<SyncResult<{}>>();55expectTypeOf(execaSync`unicorns ${[execaSync`echo foo`, 'bar']}`).toBe<SyncResult<{}>>();