Skip to content
Browse files

fixed path handling for wildcards and test module loading with require

  • Loading branch information...
1 parent 5085b39 commit 48683fbc0d9e60ffa83561f8e0c17a54e6c1f9a1 @stammen stammen committed
Showing with 18 additions and 11 deletions.
  1. +18 −11 bin/vows
View
29 bin/vows
@@ -255,17 +255,26 @@ if (! options.watch) {
reporter.reset = function () { _reporter.reset && _reporter.reset() };
reporter.print = _reporter.print;
+ // add full path if necessary
+ files = args.map(function (a) {
+ return (!a.match(/^[\/|c|C]/))
+ ? path.join(process.cwd(), a)
+ : a;
+ });
+
// preprocess the list of files for any wildcards. win32 does not handle wildcards before calling vows
// any paths not containing wildcards are simple returned by wildcard()
- args.forEach(function(a) {
- wildcardFiles = wildcardFiles.concat(wildcard(path.join(process.cwd(), a)));
+ files.forEach(function(a) {
+ if(a.indexOf('*') !== -1) {
+ wildcardFiles = wildcardFiles.concat(wildcard(a));
+ } else {
+ wildcardFiles.push(a);
+ }
});
// now set up the file list for vows including all the wildcard files
files = wildcardFiles.map(function (a) {
- return (!a.match(/^[\/|c|C]/))
- ? path.join(process.cwd(), a.replace(fileExt, ''))
- : a.replace(fileExt, '');
+ return a.replace(fileExt, '');
});
@@ -277,6 +286,7 @@ if (! options.watch) {
}
}
+
runSuites(importSuites(files), function (results) {
var status = results.errored ? 2 : (results.broken ? 1 : 0);
@@ -549,15 +559,12 @@ function importSuites(files) {
return files.reduce(options.isolate ? function (suites, f) {
- return suites.concat({
- run: wrapSpawn(f)
+ return suites.concat({
+ run: wrapSpawn(f)
});
} : function (suites, f) {
- f = path.relative(__dirname, f);
- f = f.replace(/\\/g,'/');
- f = f.replace('../C:','C:');
+ //f = path.join(process.cwd(), path.relative(process.cwd(),f));
var obj = require(f);
- f = f.replace('../','');
return suites.concat(Object.keys(obj).map(function (s) {
obj[s]._filename = cwdname(f);
return obj[s];

0 comments on commit 48683fb

Please sign in to comment.
Something went wrong with that request. Please try again.