(list)
| 42 | } |
| 43 | |
| 44 | function makeRunHook(list) { |
| 45 | return (promise) => { |
| 46 | const hookSet = ArrayPrototypeSlice(list); |
| 47 | const exceptions = []; |
| 48 | |
| 49 | for (let i = 0; i < hookSet.length; i++) { |
| 50 | const hook = hookSet[i]; |
| 51 | try { |
| 52 | hook(promise); |
| 53 | } catch (err) { |
| 54 | ArrayPrototypePush(exceptions, err); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | // Triggering exceptions is deferred to allow other hooks to complete |
| 59 | for (let i = 0; i < exceptions.length; i++) { |
| 60 | const err = exceptions[i]; |
| 61 | triggerUncaughtException(err, false); |
| 62 | } |
| 63 | }; |
| 64 | } |
| 65 | |
| 66 | const beforeAll = makeRunHook(hooks.before); |
| 67 | const afterAll = makeRunHook(hooks.after); |
no test coverage detected
searching dependent graphs…