From 48683fbc0d9e60ffa83561f8e0c17a54e6c1f9a1 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Fri, 16 Nov 2012 09:21:23 -0800 Subject: [PATCH] fixed path handling for wildcards and test module loading with require --- bin/vows | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/bin/vows b/bin/vows index 0d80ceb..3f1f88a 100755 --- a/bin/vows +++ b/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];