buster-test-win.js
1011 Bytes
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
var fs = require('fs'),
child_process = require('child_process');
var specs = [];
var walk = function(path, callback) {
var files = fs.readdirSync(path);
var count = files.length;
files.forEach(function(file) {
fs.stat(path + '/' + file, function (err, stat) {
if (stat && stat.isDirectory()) {
walk(path + '/' + file, function() {
count--;
if (count === 0) {
callback();
}
});
} else {
if (file.indexOf(".spec.js") !== -1) {
specs.push(path+'/'+file);
}
count--;
if (count === 0) {
callback();
}
}
});
});
};
walk(__dirname, function () {
var i = 0;
var exec = function () {
var spec = specs[i++];
if (spec) {
var child = child_process.exec('node ' + spec, null, function (err, stdout, sterr) {
exec();
});
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
}
}
exec();
});