-
-
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
4 changed files
with
97 additions
and
16 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
28 changes: 28 additions & 0 deletions
28
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,28 @@ | ||
'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() { | ||
if (n === 4) { | ||
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