-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Expand file tree
/
Copy pathhooks.spec.js
More file actions
48 lines (41 loc) · 1.07 KB
/
hooks.spec.js
File metadata and controls
48 lines (41 loc) · 1.07 KB
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');
var runMocha = require('./helpers').runMocha;
var splitRegExp = require('./helpers').splitRegExp;
var args = ['--reporter', 'dot'];
describe('hooks', function () {
it('are ran in correct order', function (done) {
runMocha('cascade.fixture.js', args, function (err, res) {
var lines, expected;
if (err) {
done(err);
return;
}
lines = res.output.split(splitRegExp).map(function (line) {
return line.trim();
}).filter(function (line) {
return line.length;
}).slice(0, -1);
expected = [
'before one',
'before two',
'before three',
'before each one',
'before each two',
'before each three',
'TEST three',
'after each three',
'after each two',
'after each one',
'after three',
'after two',
'after one'
];
expected.forEach(function (line, i) {
assert.equal(lines[i], line);
});
assert.equal(res.code, 0);
done();
});
});
});