MCPcopy
hub / github.com/xojs/xo / rejectionOf

Function rejectionOf

test/helpers/rejection-of.ts:10–18  ·  view source on GitHub ↗
(promise: Promise<unknown>)

Source from the content-addressed store, hash-verified

8@returns The rejection reason, typed as `ExecaError` by default.
9*/
10export const rejectionOf = async <ErrorType = ExecaError>(promise: Promise<unknown>): Promise<ErrorType> => {
11 try {
12 await promise;
13 } catch (error) {
14 return error as ErrorType;
15 }
16
17 throw new Error('Expected the promise to reject, but it resolved.');
18};

Callers 1

cli.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…