-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathtest-cli.js
More file actions
40 lines (36 loc) · 1.3 KB
/
Copy pathtest-cli.js
File metadata and controls
40 lines (36 loc) · 1.3 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
var exec = require('child_process').exec,
path = require('path');
var bin = (process.platform === 'win32' ? 'node ' : "") +
path.resolve(__dirname, '../bin/nodeunit');
var testfile_fullpath = path.resolve(__dirname, './fixtures/example_test.js');
var fixtures_path = path.resolve(__dirname, './fixtures');
exports['run test suite using absolute path'] = function (test) {
exec(bin + ' ' + testfile_fullpath, function (err, stdout, stderr) {
if (err) {
return test.done(err);
}
test.ok(/example test/.test(stdout));
test.ok(/1 assertion/.test(stdout));
test.done();
});
};
exports['runs only top-level suites without recursive flag'] = function (test) {
exec(bin + ' ' + fixtures_path, function (err, stdout, stderr) {
if (err) {
return test.done(err);
}
test.ok(/example test/.test(stdout));
test.ok(!/example test sub/.test(stdout));
test.done();
});
};
exports['runs top + nested suites with recursive flag'] = function (test) {
exec(bin + ' ' + fixtures_path + ' -r', function (err, stdout, stderr) {
if (err) {
return test.done(err);
}
test.ok(/example test/.test(stdout));
test.ok(/example test sub/.test(stdout));
test.done();
});
};