Skip to content
Myr

result-reject.test-d.ts

This file

Path

test-d/return/result-reject.test-d.ts

41 lines · 1.9 KiB · TypeScript

Last changed by

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

History of this file

Take 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 back
1import {expectTypeOf, expectError} from 'nz';

Fix type of result when using the `reject: false` option (#1046)ehmickybefore adoptionab2a9ed

lines 2–7why, one step back
2import {
3 type Result,4 type SyncResult,5 execa,6 execaSync,7} from '../../index.js';

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 8–9why, one step back
8
9const rejectsResult = await execa('unicorns');

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

line 10why, one step back
10expectTypeOf(rejectsResult).toBeAssignableTo<Result>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 11–18why, one step back
11expectError(rejectsResult.stack?.toString());
12expectError(rejectsResult.message?.toString());13expectError(rejectsResult.shortMessage?.toString());14expectError(rejectsResult.originalMessage?.toString());15expectError(rejectsResult.code?.toString());16expectError(rejectsResult.cause?.valueOf());1718const noRejectsResult = await execa('unicorns', {reject: false});

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

lines 19–25why, one step back
19expectTypeOf(noRejectsResult).toBeAssignableTo<Result>();
20expectTypeOf(noRejectsResult.stack).toBe<string | undefined>();21expectTypeOf(noRejectsResult.message).toBe<string | undefined>();22expectTypeOf(noRejectsResult.shortMessage).toBe<string | undefined>();23expectTypeOf(noRejectsResult.originalMessage).toBe<string | undefined>();24expectTypeOf(noRejectsResult.code).toBe<string | undefined>();25expectTypeOf(noRejectsResult.cause).toBe<unknown>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 26–27why, one step back
26
27const rejectsSyncResult = execaSync('unicorns');

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

line 28why, one step back
28expectTypeOf(rejectsSyncResult).toBeAssignableTo<SyncResult>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 29–36why, one step back
29expectError(rejectsSyncResult.stack?.toString());
30expectError(rejectsSyncResult.message?.toString());31expectError(rejectsSyncResult.shortMessage?.toString());32expectError(rejectsSyncResult.originalMessage?.toString());33expectError(rejectsSyncResult.code?.toString());34expectError(rejectsSyncResult.cause?.valueOf());3536const noRejectsSyncResult = execaSync('unicorns', {reject: false});

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

lines 37–41why, one step back
37expectTypeOf(noRejectsSyncResult).toBeAssignableTo<SyncResult>();
38expectTypeOf(noRejectsSyncResult.stack).toBe<string | undefined>();39expectTypeOf(noRejectsSyncResult.message).toBe<string | undefined>();40expectTypeOf(noRejectsSyncResult.shortMessage).toBe<string | undefined>();41expectTypeOf(noRejectsSyncResult.originalMessage).toBe<string | undefined>();