1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var path = require('path');
|
7 | var spawn = require('child_process').spawn;
|
8 |
|
9 |
|
10 | var node = process.execPath || process.argv[0];
|
11 | var gnode = path.resolve(__dirname, '..', 'bin', 'gnode');
|
12 | var mocha = path.resolve(__dirname, '..', 'node_modules', '.bin', 'mocha');
|
13 | var mochaOpts = [ '--reporter', 'spec' ];
|
14 |
|
15 | run([
|
16 | [ mocha, path.resolve(__dirname, 'cli.js') ]
|
17 | ]);
|
18 |
|
19 | function run (tests) {
|
20 | if (0 == tests.length) return;
|
21 | var argv = tests.shift();
|
22 | if (argv.indexOf(mocha) != -1) {
|
23 |
|
24 | argv.push.apply(argv, mochaOpts);
|
25 | }
|
26 | var opts = {
|
27 | customFds: [ 0, 1, 2 ],
|
28 | stdio: 'inherit'
|
29 | };
|
30 | var child = spawn(node, argv, opts);
|
31 | child.on('exit', function (code) {
|
32 | if (0 == code) {
|
33 | run(tests);
|
34 | } else {
|
35 | process.exit(code);
|
36 | }
|
37 | });
|
38 | }
|