-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
62 lines (50 loc) · 1.35 KB
/
index.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
'use strict';
var chalk = require('chalk');
var shell = require('shelljs');
var args = Array.prototype.slice.call(process.argv, 2);
var suiteId = args[0];
function runSuites (suitesToRun) {
console.log('Run all suites');
function runNextSuite () {
var nextSuite = suitesToRun.shift();
if (nextSuite) {
var cmd = 'node ./index.js ' + nextSuite;
shell.exec(cmd, {}, function execCallback (code, output) {
if (code !== 0) {
process.stdout.write(chalk.red(output));
process.exit(2);
}
runNextSuite();
});
}
}
runNextSuite();
}
// No suite specified, run all
if (!suiteId) {
runSuites([
'parse-array',
'parse-string',
'parse-string-format'
]);
} else {
require('./boot');
var Reporter = require('./lib/reporter/console');
var reporter = new Reporter();
var suitePath = './suite/' + suiteId;
var suite = require(suitePath);
if (!suite) {
console.log('ERROR: Suite "' + suitePath + '" not found');
process.exit(1);
}
console.log('\n' + suite.description);
console.log('==================================================================');
suite.suite
.on('cycle', function onCycle (event) {
reporter.printCycle(event);
})
.on('complete', function onComplete () {
reporter.printResults(this);
})
.run({ async: false });
}