Comparing version 1.5.3 to 1.5.4
@@ -184,4 +184,7 @@ | ||
var at = []; | ||
if (self.isAbsolute(path)) | ||
at.push(parts.shift()); | ||
if (self.isAbsolute(path)) { | ||
// On Windows use the root drive (e.g. "C:"), on *nix the first | ||
// part is the falsey "", and so use the ROOT ("/") | ||
at.push(parts.shift() || self.ROOT); | ||
} | ||
return parts.reduce(function (parent, part) { | ||
@@ -188,0 +191,0 @@ return Q.when(parent, function () { |
@@ -11,5 +11,5 @@ | ||
function MockFs(files) { | ||
function MockFs(files, workingDirectory) { | ||
if (!(this instanceof MockFs)) { | ||
return new MockFs(files); | ||
return new MockFs(files, workingDirectory); | ||
} | ||
@@ -26,3 +26,3 @@ this._root = new DirectoryNode(this, "/"); | ||
var workingDirectory = this.ROOT; | ||
workingDirectory = workingDirectory || this.ROOT; | ||
if (files) { | ||
@@ -29,0 +29,0 @@ this._init(files); |
{ | ||
"name": "q-io", | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"description": "IO using Q promises", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/kriskowal/q-io/", |
var FS = require("../../fs-boot"); | ||
var normalize = FS.normal; | ||
@@ -19,3 +20,3 @@ var specs = [ | ||
"from": "..", | ||
"to": "../.." | ||
"to": normalize("../..") | ||
}, | ||
@@ -28,7 +29,7 @@ { | ||
"from": "/foo/bar", | ||
"to": "/foo" | ||
"to": normalize("/foo") | ||
}, | ||
{ | ||
"from": "/foo", | ||
"to": "/" | ||
"to": normalize("/") | ||
}, | ||
@@ -35,0 +36,0 @@ { |
@@ -7,2 +7,3 @@ "use strict"; | ||
var Mock = require("../../../fs-mock"); | ||
var normalize = FS.normal; | ||
@@ -43,10 +44,10 @@ describe("copyTree", function () { | ||
"a", | ||
"a/b", | ||
"a/b/c", | ||
"a/b/c/d", | ||
"a/b/c/e", | ||
"a/f", | ||
"a/f/c", | ||
"a/f/c/d", | ||
"a/f/c/e" | ||
normalize("a/b"), | ||
normalize("a/b/c"), | ||
normalize("a/b/c/d"), | ||
normalize("a/b/c/e"), | ||
normalize("a/f"), | ||
normalize("a/f/c"), | ||
normalize("a/f/c/d"), | ||
normalize("a/f/c/e") | ||
]); | ||
@@ -53,0 +54,0 @@ }) |
require("../../lib/jasmine-promise"); | ||
var MockFs = require("../../../fs-mock"); | ||
var normalize = require('../../../fs').normal; | ||
@@ -44,5 +45,5 @@ describe("link", function () { | ||
"a", | ||
"a/b", | ||
"a/b/c.txt", | ||
"a/b/d.txt" | ||
normalize("a/b"), | ||
normalize("a/b/c.txt"), | ||
normalize("a/b/d.txt") | ||
]) | ||
@@ -49,0 +50,0 @@ }) |
@@ -7,2 +7,3 @@ "use strict"; | ||
var Mock = require("../../../fs-mock"); | ||
var normalize = FS.normal; | ||
@@ -27,4 +28,4 @@ describe("makeTree", function () { | ||
"a", | ||
"a/b", | ||
"a/b/c" | ||
normalize("a/b"), | ||
normalize("a/b/c") | ||
]); | ||
@@ -66,5 +67,5 @@ }) | ||
"a", | ||
"a/b", | ||
"a/b/c", | ||
"a/b/c/d" | ||
normalize("a/b"), | ||
normalize("a/b/c"), | ||
normalize("a/b/c/d") | ||
]); | ||
@@ -74,3 +75,39 @@ }) | ||
it("should make an absolute tree from a subdirectory", function () { | ||
var mock = Mock({ | ||
"a/b": { | ||
"c": { | ||
"d.ext": 66 | ||
} | ||
} | ||
}, "/a/b"); | ||
return Q.fcall(function () { | ||
return mock.makeTree("/a/b/c/x/y/z"); | ||
}) | ||
.then(function () { | ||
return Q.all([ | ||
mock.isDirectory("a/b/c/x"), | ||
mock.isDirectory("a/b/c/x/y"), | ||
mock.isDirectory("a/b/c/x/y/z") | ||
]); | ||
}) | ||
.then(function () { | ||
return mock.listTree("/"); | ||
}) | ||
.then(function (list) { | ||
expect(list).toEqual([ | ||
"/", | ||
"/a", | ||
"/a/b", | ||
"/a/b/c", | ||
"/a/b/c/d.ext", | ||
"/a/b/c/x", | ||
"/a/b/c/x/y", | ||
"/a/b/c/x/y/z" | ||
]); | ||
}); | ||
}); | ||
}); | ||
@@ -7,2 +7,3 @@ "use strict"; | ||
var Mock = require("../../../fs-mock"); | ||
var normalize = FS.normal; | ||
@@ -37,4 +38,4 @@ describe("makeTree", function () { | ||
"1", | ||
"1/2", | ||
"1/2/3", | ||
normalize("1/2"), | ||
normalize("1/2/3"), | ||
"a", | ||
@@ -41,0 +42,0 @@ "b", |
@@ -7,2 +7,3 @@ "use strict"; | ||
var Mock = require("../../../fs-mock"); | ||
var normalize = FS.normal; | ||
@@ -32,3 +33,3 @@ describe("removeTree", function () { | ||
"a", | ||
"a/b" | ||
normalize("a/b") | ||
]); | ||
@@ -35,0 +36,0 @@ }) |
require("../../lib/jasmine-promise"); | ||
var MockFs = require("../../../fs-mock"); | ||
var normalize = require('../../../fs').normal; | ||
@@ -52,5 +53,5 @@ describe("symbolic link", function () { | ||
"a", | ||
"a/b", | ||
"a/b/c.txt", | ||
"a/b/d.txt" | ||
normalize("a/b"), | ||
normalize("a/b/c.txt"), | ||
normalize("a/b/d.txt") | ||
]) | ||
@@ -57,0 +58,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
187207
49
4833