Skip to content

Commit

Permalink
path: fix positive.relative() on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Mar 14, 2021
1 parent 85edaf4 commit 19c7694
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
7 changes: 5 additions & 2 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

const {
FunctionPrototypeBind,
RegExp,
StringPrototypeCharCodeAt,
StringPrototypeLastIndexOf,
StringPrototypeSlice,
Expand Down Expand Up @@ -1099,8 +1100,10 @@ const posix = {
return '';

// Trim leading forward slashes.
from = posix.resolve(from);
to = posix.resolve(to);
from = module.exports.resolve(from)
.replace(new RegExp(`\\${module.exports.sep}`, 'g'), posix.sep);
to = module.exports.resolve(to)
.replace(new RegExp(`\\${module.exports.sep}`, 'g'), posix.sep);

if (from === to)
return '';
Expand Down
14 changes: 0 additions & 14 deletions test/known_issues/known_issues.status
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,18 @@ test-vm-timeout-escape-queuemicrotask: SKIP
[$system==win32]

[$system==linux]
# Windows-specific test
test-path-posix-relative-on-windows: SKIP

[$system==macos]
# Windows-specific test
test-path-posix-relative-on-windows: SKIP

[$system==solaris]
# Windows-specific test
test-path-posix-relative-on-windows: SKIP

[$system==freebsd]
# Windows-specific test
test-path-posix-relative-on-windows: SKIP

[$system==aix]
# Windows-specific test
test-path-posix-relative-on-windows: SKIP

[$arch==arm]
# The Raspberry Pis are too slow to run this test.
# See https://github.com/nodejs/build/issues/2227#issuecomment-608334574
test-crypto-authenticated-stream: SKIP
# Windows-specific test
test-path-posix-relative-on-windows: SKIP

[$system==ibmi]
# Windows-specific test
test-path-posix-relative-on-windows: SKIP

0 comments on commit 19c7694

Please sign in to comment.