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
3 changed files
with
75 additions
and
13 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
test/integration/fixtures/pending/skip-sync-beforeEach-cond.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,26 @@ | ||
'use strict'; | ||
|
||
describe('skip conditionally in beforeEach', function () { | ||
var n = 1; | ||
beforeEach(function () { | ||
if (n !== 2) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it('should never run this test-1', function () { | ||
throw new Error('never run this test'); | ||
}); | ||
it('should run this test-2', function () {}); | ||
|
||
describe('inner suite', function() { | ||
it('should never run this test-3', function () { | ||
throw new Error('never run this test'); | ||
}); | ||
}); | ||
|
||
afterEach(function() { n++; }); | ||
after(function() { | ||
throw new Error('should throw this error'); | ||
}); | ||
}); |
21 changes: 18 additions & 3 deletions
21
test/integration/fixtures/pending/skip-sync-beforeEach.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 |
---|---|---|
@@ -1,15 +1,30 @@ | ||
'use strict'; | ||
var assert = require('assert'); | ||
|
||
describe('skip in beforeEach', function () { | ||
var runOrder = []; | ||
beforeEach(function () { | ||
runOrder.push('beforeEach'); | ||
this.skip(); | ||
}); | ||
|
||
it('should never run this test', function () { | ||
it('should never run this test-1', function () { | ||
throw new Error('never run this test'); | ||
}); | ||
|
||
it('should never run this test', function () { | ||
it('should never run this test-2', function () { | ||
throw new Error('never run this test'); | ||
}); | ||
|
||
afterEach(function() { | ||
runOrder.push('afterEach'); | ||
}); | ||
after(function() { | ||
runOrder.push('after'); | ||
assert.deepStrictEqual(runOrder, [ | ||
'beforeEach', 'afterEach', | ||
'beforeEach', 'afterEach', | ||
'after' | ||
]); | ||
throw new Error('should throw this error'); | ||
}); | ||
}); |
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