-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
227 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
var assert = require('assert'); | ||
|
||
function getTitle(ctx) { | ||
return ctx.currentTest && ctx.currentTest.title; | ||
}; | ||
|
||
before(function () { | ||
assert.equal(getTitle(this), undefined); | ||
}); | ||
|
||
describe('suite A', () => { | ||
|
||
before(function () { | ||
assert.equal(getTitle(this), undefined); | ||
}); | ||
|
||
describe('suite B', () => { | ||
|
||
it('test1 B', () => {}); | ||
|
||
describe('suite C', function () { | ||
var lap = 0; | ||
|
||
before(function () { | ||
assert.equal(getTitle(this), 'test1 C'); | ||
}); | ||
beforeEach(function () { | ||
assert.equal(getTitle(this), ++lap === 1 ? 'test1 C' : 'test2 C'); | ||
}); | ||
|
||
it('test1 C', function () {}); | ||
it('test2 C', function () {}); | ||
|
||
afterEach(function () { | ||
assert.equal(getTitle(this), lap === 1 ? 'test1 C' : 'test2 C'); | ||
}); | ||
after(function () { | ||
assert.equal(getTitle(this), 'test2 C'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
after(function () { | ||
assert.equal(getTitle(this), undefined); | ||
}); |
13 changes: 13 additions & 0 deletions
13
test/integration/fixtures/hooks/after-hook-deepnested-error.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
describe('spec 1', function () { | ||
it('should pass', function () { }); | ||
describe('spec 2 nested - this title should be used', function () { | ||
after(function() { | ||
throw new Error('after hook nested error'); | ||
}); | ||
describe('spec 3 nested', function () { | ||
it('it nested - this title should not be used', function () { }); | ||
}); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
test/integration/fixtures/hooks/after-hook-nested-error.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
describe('spec 1', function () { | ||
it('should pass', function () { }); | ||
describe('spec nested', function () { | ||
after(function() { | ||
throw new Error('after hook nested error'); | ||
}); | ||
it('it nested - this title should be used', function () { }); | ||
}); | ||
describe('spec 2 nested', function () { | ||
it('it nested - not this title', function () { }); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
test/integration/fixtures/hooks/before-hook-deepnested-error.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
describe('spec 1', function () { | ||
it('should pass', function () { }); | ||
describe('spec 2 nested - this title should be used', function () { | ||
before(function() { | ||
throw new Error('before hook nested error'); | ||
}); | ||
describe('spec 3 nested', function () { | ||
it('it nested - this title should not be used', function () { }); | ||
}); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
test/integration/fixtures/hooks/before-hook-nested-error.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
describe('spec 1', function () { | ||
it('should pass', function () { }); | ||
describe('spec nested', function () { | ||
before(function() { | ||
throw new Error('before hook nested error'); | ||
}); | ||
it('it nested - this title should be used', function () { }); | ||
}); | ||
}); |
9 changes: 9 additions & 0 deletions
9
test/integration/fixtures/hooks/before-hook-root-error.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
before(function() { | ||
throw new Error('before hook root error'); | ||
}); | ||
|
||
describe('spec 1', function () { | ||
it('should not be called', function () { }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters