chore(traceur-jasmine): accept multiple specfile globs

This commit is contained in:
Caitlin Potter 2015-05-13 22:40:04 -04:00
parent 6c59894a29
commit 28659efa69
1 changed files with 21 additions and 10 deletions

View File

@ -7,14 +7,25 @@ var path = require('path');
require('traceur/bin/traceur-runtime.js');
require('reflect-metadata/Reflect');
glob(process.argv[2], function (error, specFiles) {
minijasminenode2.executeSpecs({
includeStackTrace: true,
defaultTimeoutInterval: 1000,
showColors: process.argv.indexOf('--no-color') === -1,
specs: specFiles,
onComplete: function(passed) {
process.exit(passed ? 0 : 1);
}
});
// Support passing multiple globs
var globsIndex = process.argv.indexOf('--');
var args;
if (globsIndex < 0) {
args = [process.argv[2]];
} else {
args = process.argv.slice(globsIndex + 1);
}
var specFiles = args.
map(function(globstr) { return glob.sync(globstr); }).
reduce(function(specFiles, paths) { return specFiles.concat(paths); }, []);
minijasminenode2.executeSpecs({
includeStackTrace: true,
defaultTimeoutInterval: 1000,
showColors: process.argv.indexOf('--no-color') === -1,
specs: specFiles,
onComplete: function(passed) {
process.exit(passed ? 0 : 1);
}
});