☕️ Classic, reliable, trusted test framework for Node.js and the browser
Added nested serial hook test to show execution order
Tj Holowaychuk895fff5c7337
diff --git a/test/unit/beforeEach.nested.serial.js b/test/unit/beforeEach.nested.serial.jsnew file mode 100644index 00000000..b2c3a90f--- /dev/null+++ b/test/unit/beforeEach.nested.serial.js@@ -0,0 +1,66 @@++describe('serial', function(){+ var calls = [];++ beforeEach(function(test){+ calls.push('parent before ' + test.title);+ });++ afterEach(function(test){+ calls.push('parent after ' + test.title);+ });++ it('foo', function(){+ calls.should.eql([+ 'before one'+ , 'after one'+ , 'before two'+ , 'after two'+ , 'before three'+ , 'after three'+ , 'parent before foo']);+ });++ it('bar', function(){+ calls.should.eql([+ 'before one'+ , 'after one'+ , 'before two'+ , 'after two'+ , 'before three'+ , 'after three'+ , 'parent before foo'+ , 'parent after foo'+ , 'parent before bar']);+ });++ describe('beforeEach()', function(){+ beforeEach(function(test){+ calls.push('before ' + test.title);+ });++ it('one', function(){+ calls.should.eql(['before one']);+ });++ it('two', function(){+ calls.should.eql([+ 'before one'+ , 'after one'+ , 'before two']);+ });++ it('three', function(){+ calls.should.eql([+ 'before one'+ , 'after one'+ , 'before two'+ , 'after two'+ , 'before three']);+ });++ afterEach(function(test){+ calls.push('after ' + test.title);+ });+ });+});\ No newline at end of file