/
suite.spec.js
70 lines (65 loc) · 1.85 KB
/
suite.spec.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
'use strict';
var run = require('./helpers').runMocha;
var args = [];
describe('suite w/no callback', function() {
it('should throw a helpful error message when a callback for suite is not supplied', function(done) {
run(
'suite/suite-no-callback.fixture.js',
args,
function(err, res) {
if (err) {
return done(err);
}
expect(
res.output,
'to match',
/no callback was supplied. Supply a callback/
);
done();
},
{stdio: 'pipe'}
);
});
});
describe('skipped suite w/no callback', function() {
it('should not throw an error when a callback for skipped suite is not supplied', function(done) {
run('suite/suite-skipped-no-callback.fixture.js', args, function(err, res) {
if (err) {
return done(err);
}
var pattern = /TypeError/g;
var result = res.output.match(pattern) || [];
expect(result, 'to have length', 0);
done();
});
});
});
describe('skipped suite w/ callback', function() {
it('should not throw an error when a callback for skipped suite is supplied', function(done) {
run('suite/suite-skipped-callback.fixture.js', args, function(err, res) {
if (err) {
return done(err);
}
var pattern = /TypeError/g;
var result = res.output.match(pattern) || [];
expect(result, 'to have length', 0);
done();
});
});
});
describe('suite returning a value', function() {
it('should not give a deprecation warning for suite callback returning a value', function(done) {
run(
'suite/suite-returning-value.fixture.js',
args,
function(err, res) {
if (err) {
return done(err);
}
expect(res, 'not to contain output', /Suites ignore return values/);
done();
},
{stdio: 'pipe'}
);
});
});