( thunk: () => Promise<void>, error?: Error | ((u: unknown) => undefined), ..._: Array<never> )
| 95 | } |
| 96 | |
| 97 | export async function throwsAsync( |
| 98 | thunk: () => Promise<void>, |
| 99 | error?: Error | ((u: unknown) => undefined), |
| 100 | ..._: Array<never> |
| 101 | ) { |
| 102 | try { |
| 103 | await thunk() |
| 104 | fail("Expected to throw an error") |
| 105 | } catch (e) { |
| 106 | if (error !== undefined) { |
| 107 | if (Predicate.isFunction(error)) { |
| 108 | error(e) |
| 109 | } else { |
| 110 | deepStrictEqual(e, error) |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | // ---------------------------- |
| 117 | // Option |
nothing calls this directly
no test coverage detected