fix path tests on windows (#3276)

This commit is contained in:
Tomás Barreiro
2025-05-07 22:22:58 +05:30
committed by GitHub
parent 5275f2eabc
commit 39c7da301c
+6 -6
View File
@@ -34,20 +34,20 @@ describe("Path Utilities", () => {
})
it("should show relative paths within cwd", () => {
const cwd = "/home/user/project"
const filePath = "/home/user/project/src/file.txt"
const cwd = path.resolve("/home/user/project")
const filePath = path.resolve("/home/user/project/src/file.txt")
getReadablePath(cwd, filePath).should.equal("src/file.txt")
})
it("should show basename when path equals cwd", () => {
const cwd = "/home/user/project"
const cwd = path.resolve("/home/user/project")
getReadablePath(cwd, cwd).should.equal("project")
})
it("should show absolute path when outside cwd", () => {
const cwd = "/home/user/project"
const filePath = "/home/user/other/file.txt"
getReadablePath(cwd, filePath).should.equal(filePath)
const cwd = path.resolve("/home/user/project")
const filePath = path.resolve("/home/user/other/file.txt")
getReadablePath(cwd, filePath).should.equal(filePath.toPosix())
})
})
})