aboutsummaryrefslogtreecommitdiff
path: root/test/js/node/path/path.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/node/path/path.test.js')
-rw-r--r--test/js/node/path/path.test.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/js/node/path/path.test.js b/test/js/node/path/path.test.js
index 3c8a04d72..5865d6182 100644
--- a/test/js/node/path/path.test.js
+++ b/test/js/node/path/path.test.js
@@ -415,6 +415,9 @@ it("path.join", () => {
it("path.relative", () => {
const failures = [];
+ const cwd = process.cwd();
+ const cwdParent = path.dirname(cwd);
+ const parentIsRoot = cwdParent == "/";
const relativeTests = [
// [
@@ -477,6 +480,16 @@ it("path.relative", () => {
["/webp4ck-hot-middleware", "/webpack/buildin/module.js", "../webpack/buildin/module.js"],
["/webpack-hot-middleware", "/webp4ck/buildin/module.js", "../webp4ck/buildin/module.js"],
["/var/webpack-hot-middleware", "/var/webpack/buildin/module.js", "../webpack/buildin/module.js"],
+ ["/app/node_modules/pkg", "../static", `../../..${parentIsRoot ? "" : cwdParent}/static`],
+ ["/app/node_modules/pkg", "../../static", `../../..${parentIsRoot ? "" : path.dirname(cwdParent)}/static`],
+ ["/app", "../static", `..${parentIsRoot ? "" : cwdParent}/static`],
+ ["/app", "../".repeat(64) + "static", "../static"],
+ [".", "../static", cwd == "/" ? "static" : "../static"],
+ ["/", "../static", parentIsRoot ? "static" : `${cwdParent}/static`.slice(1)],
+ ["../", "../", ""],
+ ["../", "../../", parentIsRoot ? "" : ".."],
+ ["../../", "../", parentIsRoot ? "" : path.basename(cwdParent)],
+ ["../../", "../../", ""],
],
],
];