MCPcopy Index your code
hub / github.com/Effect-TS/effect / throwsAsync

Function throwsAsync

packages/effect/test/util.ts:97–114  ·  view source on GitHub ↗
(
  thunk: () => Promise<void>,
  error?: Error | ((u: unknown) => undefined),
  ..._: Array<never>
)

Source from the content-addressed store, hash-verified

95}
96
97export 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

Callers

nothing calls this directly

Calls 3

failFunction · 0.70
deepStrictEqualFunction · 0.70
errorFunction · 0.50

Tested by

no test coverage detected