☕️ Classic, reliable, trusted test framework for Node.js and the browser
Removed test arg from hooks
Tj Holowaychuk812509828361
diff --git a/lib/runner.js b/lib/runner.jsindex 20f64f19..a7c64bf8 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -74,7 +74,7 @@ Runner.prototype.hook = function(name, fn){if (2 == callback.length) {// asynctry {- callback(test, function(err){+ callback(function(err){if (err) return fn(err);next(++i);});@@ -86,7 +86,7 @@ Runner.prototype.hook = function(name, fn){// serialtry {- callback(test);+ callback();next(++i);} catch (err) {fn(err);diff --git a/test/unit/hook.async.js b/test/unit/hook.async.jsindex 5e271fe5..db6301a6 100644--- a/test/unit/hook.async.js+++ b/test/unit/hook.async.js@@ -14,14 +14,14 @@ describe('async', function(){, 'after all']);})- beforeEach(function(test, done){+ beforeEach(function(){// not hit- calls.push('parent before ' + test.title);+ calls.push('parent before');})- afterEach(function(test, done){+ afterEach(function(){// not hit- calls.push('parent after ' + test.title);+ calls.push('parent after' );})describe('beforeEach()', function(){@@ -33,7 +33,7 @@ describe('async', function(){calls.push('after all');});- beforeEach(function(test, done){+ beforeEach(function(done){process.nextTick(function(){calls.push('before ' + test.title);done();@@ -65,7 +65,7 @@ describe('async', function(){, 'before three']);})- afterEach(function(test, done){+ afterEach(function(done){process.nextTick(function(){calls.push('after ' + test.title);done();diff --git a/test/unit/hook.sync.js b/test/unit/hook.sync.jsindex 3216a72f..da46b798 100644--- a/test/unit/hook.sync.js+++ b/test/unit/hook.sync.js@@ -2,43 +2,62 @@describe('serial', function(){var calls = [];- beforeEach(function(test){+ beforeEach(function(){// not hit- calls.push('parent before ' + test.title);+ calls.push('parent before');})- afterEach(function(test){+ afterEach(function(){// not hit- calls.push('parent after ' + test.title);+ calls.push('parent after');})describe('beforeEach()', function(){- beforeEach(function(test){- calls.push('before ' + test.title);+ beforeEach(function(){+ calls.push('before');})it('one', function(){- calls.should.eql(['before one']);+ calls.should.eql(['before']);+ calls.push('one');})it('two', function(){calls.should.eql([- 'before one'- , 'after one'- , 'before two']);+ 'before'+ , 'one'+ , 'after'+ , 'before']);+ calls.push('two');})it('three', function(){calls.should.eql([- 'before one'- , 'after one'- , 'before two'- , 'after two'- , 'before three']);+ 'before'+ , 'one'+ , 'after'+ , 'before'+ , 'two'+ , 'after'+ , 'before']);+ calls.push('three');})- afterEach(function(test){- calls.push('after ' + test.title);+ afterEach(function(){+ calls.push('after');+ })++ after(function(){+ calls.should.eql([+ 'before'+ , 'one'+ , 'after'+ , 'before'+ , 'two'+ , 'after'+ , 'before'+ , 'three'+ , 'after']);})})})\ No newline at end of file