Skip to content

Commit c6893e6

Browse files
committed
Separate paths with / in resolveUriToFile
1 parent 17e64fa commit c6893e6

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

lib/fingerprints.test.js

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fingerprints.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/fingerprints.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,11 @@ test("resolveUriToFile", (t) => {
139139
// so we need to give it real files to look at. We will use this file as an example.
140140
// For this to work we require the current working directory to be a parent, but this
141141
// should generally always be the case so this is fine.
142-
const cwd = process.cwd();
143-
const filepath = __filename;
144-
t.true(filepath.startsWith(cwd + path.sep));
145-
const relativeFilepath = filepath.substring(cwd.length + 1);
142+
const filepath = __filename.split(path.sep).join("/");
143+
const relativeFilepath = path
144+
.relative(process.cwd(), __filename)
145+
.split(path.sep)
146+
.join("/");
146147

147148
// Absolute paths are unmodified
148149
t.is(testResolveUriToFile(filepath, undefined, []), filepath);

0 commit comments

Comments
 (0)