MCPcopy Index your code
hub / github.com/deployd/deployd / next

Function next

test-app/public/mocha.js:4923–4967  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

4921 var self = this;
4922
4923 function next(i) {
4924 var hook = hooks[i];
4925 if (!hook) {
4926 return fn();
4927 }
4928 self.currentRunnable = hook;
4929
4930 hook.ctx.currentTest = self.test;
4931
4932 self.emit('hook', hook);
4933
4934 if (!hook.listeners('error').length) {
4935 hook.on('error', function(err) {
4936 self.failHook(hook, err);
4937 });
4938 }
4939
4940 hook.run(function(err) {
4941 var testError = hook.error();
4942 if (testError) {
4943 self.fail(self.test, testError);
4944 }
4945 if (err) {
4946 if (err instanceof Pending) {
4947 if (name === 'beforeEach' || name === 'afterEach') {
4948 self.test.pending = true;
4949 } else {
4950 suite.tests.forEach(function(test) {
4951 test.pending = true;
4952 });
4953 // a pending hook won't be executed twice.
4954 hook.pending = true;
4955 }
4956 } else {
4957 self.failHook(hook, err);
4958
4959 // stop executing hooks, notify callee of hook err
4960 return fn(err);
4961 }
4962 }
4963 self.emit('hook end', hook);
4964 delete hook.ctx.currentTest;
4965 next(++i);
4966 });
4967 }
4968
4969 Runner.immediately(function() {
4970 next(0);

Callers 2

mocha.jsFile · 0.70
util.test.jsFile · 0.50

Calls 3

fnFunction · 0.85
hookErrFunction · 0.85
doneFunction · 0.70

Tested by

no test coverage detected