( thunk: () => Promise<void>, error?: Error | ((u: unknown) => undefined), ..._: Array<never> )
| 98 | export function assertMatch(actual: string, regExp: RegExp, ..._: Array<never>) { |
| 99 | if (!regExp.test(actual)) { |
| 100 | fail(`Expected\n\n${actual}\n\nto match\n\n${regExp}`) |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | export function throws(thunk: () => void, error?: string | Error | ((u: unknown) => undefined), ..._: Array<never>) { |
| 105 | try { |
| 106 | thunk() |
| 107 | } catch (e) { |
| 108 | if (error !== undefined) { |
| 109 | if (Predicate.isString(error)) { |
| 110 | assertInstanceOf(e, Error) |
| 111 | strictEqual(e.message, error) |
| 112 | } else if (Predicate.isError(error)) { |
| 113 | deepStrictEqual(e, error) |
| 114 | } else { |
| 115 | error(e) |
| 116 | } |
| 117 | } |
| 118 | return |
| 119 | } |
| 120 | fail("Expected to throw an error") |
| 121 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…