MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / runHook

Function runHook

test/unit/mocha/asyncWrapper_test.js:20–36  ·  view source on GitHub ↗
(hookFn, ms = 2000)

Source from the content-addressed store, hash-verified

18// callback fired and the argument it received. A done that never fires becomes
19// a fast, named rejection instead of a mocha timeout.
20function runHook(hookFn, ms = 2000) {
21 return new Promise((resolve, reject) => {
22 let count = 0
23 let arg
24 const timer = setTimeout(() => reject(new Error('done callback was never called')), ms)
25 timer.unref?.()
26 hookFn(err => {
27 count++
28 arg = err
29 const settle = setTimeout(() => {
30 clearTimeout(timer)
31 resolve({ count, arg })
32 }, 50)
33 settle.unref?.()
34 })
35 })
36}
37
38describe('AsyncWrapper', () => {
39 beforeEach(async () => {

Callers 7

runHooksMethod · 0.85
bootstrapMethod · 0.85
teardownMethod · 0.85
bootstrapAllMethod · 0.85
teardownAllMethod · 0.85
run-multiple.jsFile · 0.85

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected