-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
skip-async-beforeEach.fixture.js
48 lines (42 loc) · 1.08 KB
/
skip-async-beforeEach.fixture.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict';
var assert = require('assert');
describe('skip in beforeEach', function() {
var runOrder = [];
beforeEach(function(done) {
runOrder.push('beforeEach');
var self = this;
setTimeout(function() {
self.skip(); // done() is not required
}, 10);
});
it('should skip this test-1', function() {
throw new Error('never run this test');
});
describe('inner', function() {
beforeEach(function() {
runOrder.push('should not run');
});
it('should skip this test-2', function() {
throw new Error('never run this test');
});
it('should skip this test-3', function() {
throw new Error('never run this test');
});
afterEach(function() {
runOrder.push('should not run');
});
});
afterEach(function() {
runOrder.push('afterEach');
});
after(function() {
runOrder.push('after');
assert.deepStrictEqual(runOrder, [
'beforeEach', 'afterEach',
'beforeEach', 'afterEach',
'beforeEach', 'afterEach',
'after'
]);
throw new Error('should throw this error');
});
});