Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigtaub/85f84f5946aab2e8b5987ad34b05e478 to your computer and use it in GitHub Desktop.
Save craigtaub/85f84f5946aab2e8b5987ad34b05e478 to your computer and use it in GitHub Desktop.
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