MCPcopy
hub / github.com/amark/gun / next

Function next

test/mocha.js:4520–4556  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

4518 var self = this;
4519
4520 function next(i) {
4521 var hook = hooks[i];
4522 if (!hook) {
4523 return fn();
4524 }
4525 self.currentRunnable = hook;
4526
4527 hook.ctx.currentTest = self.test;
4528
4529 self.emit('hook', hook);
4530
4531 if (!hook.listeners('error').length) {
4532 hook.on('error', function(err) {
4533 self.failHook(hook, err);
4534 });
4535 }
4536
4537 hook.run(function(err) {
4538 var testError = hook.error();
4539 if (testError) {
4540 self.fail(self.test, testError);
4541 }
4542 if (err) {
4543 if (err instanceof Pending) {
4544 suite.pending = true;
4545 } else {
4546 self.failHook(hook, err);
4547
4548 // stop executing hooks, notify callee of hook err
4549 return fn(err);
4550 }
4551 }
4552 self.emit('hook end', hook);
4553 delete hook.ctx.currentTest;
4554 next(++i);
4555 });
4556 }
4557
4558 Runner.immediately(function() {
4559 next(0);

Callers 3

mocha.jsFile · 0.70
fnFunction · 0.50
tmp.jsFile · 0.50

Calls 3

hookErrFunction · 0.85
doneFunction · 0.70
fnFunction · 0.50

Tested by

no test coverage detected