Skip to content

Commit b275024

Browse files
committed
[isolate] implement runner
1 parent 3543c0e commit b275024

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

bin/vows

+30-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,36 @@ function runSuites(suites, callback) {
384384
function importSuites(files) {
385385
msg(options.watcher ? 'watcher' : 'runner', 'loading', files);
386386

387-
return files.reduce(function (suites, f) {
387+
var exec = require('child_process').exec;
388+
389+
function wrapExec(f) {
390+
return function(options, callback) {
391+
var cmd = process.argv.slice(0, 2).concat('--json');
392+
393+
exec(cmd.join(' '), function (err, stdout, stderr) {
394+
if (err) {
395+
reporter.report(['error', stderr]);
396+
callback({
397+
errored: 1,
398+
total: 1
399+
});
400+
return;
401+
}
402+
403+
var result = stdout.split(/\n/g).map(function(i) {
404+
if (i) {
405+
reporter.report(JSON.parse(i));
406+
}
407+
});
408+
})
409+
}
410+
}
411+
412+
return files.reduce(options.isolate ? function (suites, f) {
413+
return suites.concat({
414+
run: wrapExec(f)
415+
});
416+
} : function (suites, f) {
388417
var obj = require(f);
389418
return suites.concat(Object.keys(obj).map(function (s) {
390419
obj[s]._filename = f.replace(process.cwd() + '/', '') + '.js';

0 commit comments

Comments
 (0)