Created
June 6, 2020 17:29
-
-
Save craigtaub/85f84f5946aab2e8b5987ad34b05e478 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Runner.prototype.hook = function (name, fn) { | |
// 1. for current suite, get hooks with name x | |
var hooks = this.suite.getHooks(name); | |
function next(i){ | |
// 3. grab current hook | |
var hook = hooks[i]; | |
// 4. executed all hooks under name x for suite | |
if (!hook) fn() | |
// set hooks test context | |
hook.ctx.currentTest = ... | |
// 5. execute hook. | |
hook.run(() => { | |
// 6. end of hook trigger next hook | |
next(++i) | |
}); | |
} | |
// 2. trigger start of hooks | |
next(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment