forked from jspears/mers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathws-run.js
40 lines (33 loc) · 939 Bytes
/
ws-run.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
var Mocha = require('mocha'),
path = require('path'),
fs = require('fs');
var mocha = new Mocha({
reporter: 'dot',
ui: 'bdd',
// grep:'should be accessible from an url with an index and use a transformer and single mode is true',
timeout: 999999
});
var testDir = './test';
var mochaRe = /.*-mocha\.js$/;
fs.readdir(testDir, function (err, files) {
if (err) {
console.log(err);
return;
}
files.forEach(function (file) {
if (mochaRe.test(file)) {
console.log('adding test file: %s', file);
mocha.addFile(path.join(testDir , file));
}
});
var runner = mocha.run(function () {
console.log('finished');
process.exit(0);
});
runner.on('pass', function (test) {
console.log('... %s passed', test.title);
});
runner.on('fail', function (test) {
console.log('... %s failed', test.title);
});
});