diff --git a/README.md b/README.md index 094f391..947d876 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ Using the built in server ------------------------- Using the `--server` command will fire up a server in the `process.cwd()` and serve anything -under it as statis content. Then when you select the tests to be run, they are converted to URL's +under it as static content. Then when you select the tests to be run, they are converted to URL's under the hood and fetched from the static server instead of the file system. Combine this with `-S` options like this: diff --git a/lib/options.js b/lib/options.js index 0a200ce..436a538 100644 --- a/lib/options.js +++ b/lib/options.js @@ -26,11 +26,11 @@ var path = require('path'), }, newPath, paths, a, p, t, v, concurrent, coverageFileName, sourceFilePrefix, phantom, stat, getPaths = function(opt) { - if (process.platform === 'win32' && !options.suffix) { //If options.suffix it's probably URL + if (process.platform === 'win32' && !options.suffix && !options.prefix && !options.server) { //If options.suffix it's probably a URL var g = glob.sync(opt, { cwd: process.cwd() }).map(function (filepath) { - return path.join(process.cwd(), filepath); + return path.relative(process.cwd(), filepath); //phantomjs won't "request" relative resources for absolute Windows paths }); if (g && g.length) { options.paths = [].concat(options.paths, g); diff --git a/tests/1-args.js b/tests/1-args.js index c7a02bb..df2c795 100644 --- a/tests/1-args.js +++ b/tests/1-args.js @@ -612,8 +612,8 @@ var tests = { process.platform = _platform; return ret; }, - 'should expand 7 paths': function(topic) { - assert.equal(topic.paths.length, 7); + 'should expand 8 paths': function(topic) { + assert.equal(topic.paths.length, 8); } }, 'no files': { @@ -627,6 +627,19 @@ var tests = { 'should expand 0 paths': function(topic) { assert.equal(topic.paths.length, 0); } + }, + 'files on Windows': { + topic: function() { + var _platform = process.platform, ret; + process.platform = 'win32'; + ret = parse(['tests/html/relative.html', path.join(__dirname, '../tests/html/relative.html')]); + process.platform = _platform; + return ret; + }, + 'should return relative paths': function(topic) { + assert.equal(topic.paths[0], path.join('tests', 'html', 'relative.html')); + assert.equal(topic.paths[1], path.join('tests', 'html', 'relative.html')); + } } } }; diff --git a/tests/html/assets/relativetest.js b/tests/html/assets/relativetest.js new file mode 100644 index 0000000..3cd2220 --- /dev/null +++ b/tests/html/assets/relativetest.js @@ -0,0 +1 @@ +relativeVar = true; \ No newline at end of file diff --git a/tests/html/relative.html b/tests/html/relative.html new file mode 100644 index 0000000..b5d8ac3 --- /dev/null +++ b/tests/html/relative.html @@ -0,0 +1,25 @@ + + + + Test One + + + + + + + +