( fn: Circus.HookFn, hookType: Circus.HookType, hookFn: THook, timeout?: number, )
| 91 | }; |
| 92 | |
| 93 | const _addHook = ( |
| 94 | fn: Circus.HookFn, |
| 95 | hookType: Circus.HookType, |
| 96 | hookFn: THook, |
| 97 | timeout?: number, |
| 98 | ) => { |
| 99 | const asyncError = new ErrorWithStack(undefined, hookFn); |
| 100 | |
| 101 | if (typeof fn !== 'function') { |
| 102 | asyncError.message = |
| 103 | 'Invalid first argument. It must be a callback function.'; |
| 104 | |
| 105 | throw asyncError; |
| 106 | } |
| 107 | |
| 108 | dispatchSync({asyncError, fn, hookType, name: 'add_hook', timeout}); |
| 109 | }; |
| 110 | |
| 111 | // Hooks have to pass themselves to the HOF in order for us to trim stack traces. |
| 112 | const beforeEach: THook = (fn, timeout) => |
no test coverage detected