Fix loading modules from an absolute path on Windows.

Don't check the module path using Linux-style path checking.

Issue #11165: https://github.com/ariya/phantomjs/issues/11165
1.x
Vitaliy Slobodin 2013-03-25 03:02:51 +04:00 committed by Ariya Hidayat
parent da71c5fbdd
commit 9ca45ed62e
2 changed files with 7 additions and 1 deletions

View File

@ -216,7 +216,7 @@ phantom.callback = function(callback) {
if (request[0] === '.') {
paths.push(fs.absolute(joinPath(phantom.webdriverMode ? ":/ghostdriver" : this.dirname, request)));
} else if (request[0] === '/') {
} else if (fs.isAbsolute(request)) {
paths.push(fs.absolute(request));
} else {
// first look in PhantomJS modules

View File

@ -154,4 +154,10 @@ describe("require()", function() {
});
});
});
describe("when path is absolute", function() {
it("loads modules from the absolute path", function() {
require(fs.absolute('dummy')).should.equal('spec/dummy');
});
});
});