Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

nest describe()

Tj Holowaychuk7fb4ca91d8a0
diff --git a/test/unit/beforeEach.nested.serial.js b/test/unit/beforeEach.nested.serial.js
index b2c3a90f..73a88eb9 100644
--- a/test/unit/beforeEach.nested.serial.js
+++ b/test/unit/beforeEach.nested.serial.js
@@ -1,66 +1,68 @@
describe('serial', function(){
- var calls = [];
+ describe('nested', 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);
+ calls.push('parent before ' + test.title);
});
- it('one', function(){
- calls.should.eql(['before one']);
+ afterEach(function(test){
+ calls.push('parent after ' + test.title);
});
- it('two', function(){
+ it('foo', function(){
calls.should.eql([
'before one'
, 'after one'
- , 'before two']);
+ , 'before two'
+ , 'after two'
+ , 'before three'
+ , 'after three'
+ , 'parent before foo']);
});
- it('three', function(){
+ it('bar', function(){
calls.should.eql([
'before one'
, 'after one'
, 'before two'
, 'after two'
- , 'before three']);
+ , 'before three'
+ , 'after three'
+ , 'parent before foo'
+ , 'parent after foo'
+ , 'parent before bar']);
});
- afterEach(function(test){
- calls.push('after ' + test.title);
+ 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