Skip to content
This repository was archived by the owner on Jan 10, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 15 additions & 2 deletions tests/1-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand All @@ -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'));
}
}
}
};
Expand Down
1 change: 1 addition & 0 deletions tests/html/assets/relativetest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
relativeVar = true;
25 changes: 25 additions & 0 deletions tests/html/relative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!doctype html>
<html>
<head>
<title>Test One</title>
</head>
<body>
<script src="http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js"></script>
<script src="./assets/relativetest.js"></script>
<script>
YUI().use('test', function(Y) {
var suite = new Y.Test.Suite('Relative Test');
suite.add(new Y.Test.Case({
name: 'relative',

'should be able to see relativeVar': function() {
Y.Assert.isTrue(relativeVar);
}
}));

Y.Test.Runner.add(suite).run();
});
</script>
</body>
</html>