| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,11 +23,15 @@ | |||
| 23 | 23 | ||
| 24 | 24 | const { | |
| 25 | 25 | FunctionPrototypeBind, | |
| 26 | + RegExp, | ||
| 26 | 27 | StringPrototypeCharCodeAt, | |
| 28 | + StringPrototypeIndexOf, | ||
| 27 | 29 | StringPrototypeLastIndexOf, | |
| 30 | + StringPrototypeReplace, | ||
| 28 | 31 | StringPrototypeSlice, | |
| 29 | 32 | StringPrototypeToLowerCase, | |
| 30 | 33 | } = primordials; | |
| 34 | + | ||
| 31 | 35 | const { | |
| 32 | 36 | CHAR_UPPERCASE_A, | |
| 33 | 37 | CHAR_LOWERCASE_A, | |
@@ -1014,7 +1018,17 @@ const posix = { | |||
| 1014 | 1018 | let resolvedAbsolute = false; | |
| 1015 | 1019 | ||
| 1016 | 1020 | for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { | |
| 1017 | - const path = i >= 0 ? args[i] : process.cwd(); | ||
| 1021 | + let path; | ||
| 1022 | + if (i >= 0) { | ||
| 1023 | + path = args[i]; | ||
| 1024 | + } else { | ||
| 1025 | + const _ = StringPrototypeReplace( | ||
| 1026 | + process.cwd(), | ||
| 1027 | + new RegExp(`\\${module.exports.sep}`, 'g'), | ||
| 1028 | + posix.sep | ||
| 1029 | + ); | ||
| 1030 | + path = StringPrototypeSlice(_, StringPrototypeIndexOf(_, posix.sep)); | ||
| 1031 | + } | ||
| 1018 | 1032 | ||
| 1019 | 1033 | validateString(path, 'path'); | |
| 1020 | 1034 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,32 +15,18 @@ test-vm-timeout-escape-queuemicrotask: SKIP | |||
| 15 | 15 | [$system==win32] | |
| 16 | 16 | ||
| 17 | 17 | [$system==linux] | |
| 18 | - # Windows-specific test | ||
| 19 | - test-path-posix-relative-on-windows: SKIP | ||
| 20 | 18 | ||
| 21 | 19 | [$system==macos] | |
| 22 | - # Windows-specific test | ||
| 23 | - test-path-posix-relative-on-windows: SKIP | ||
| 24 | 20 | ||
| 25 | 21 | [$system==solaris] | |
| 26 | - # Windows-specific test | ||
| 27 | - test-path-posix-relative-on-windows: SKIP | ||
| 28 | 22 | ||
| 29 | 23 | [$system==freebsd] | |
| 30 | - # Windows-specific test | ||
| 31 | - test-path-posix-relative-on-windows: SKIP | ||
| 32 | 24 | ||
| 33 | 25 | [$system==aix] | |
| 34 | - # Windows-specific test | ||
| 35 | - test-path-posix-relative-on-windows: SKIP | ||
| 36 | 26 | ||
| 37 | 27 | [$arch==arm] | |
| 38 | 28 | # The Raspberry Pis are too slow to run this test. | |
| 39 | 29 | # See https://github.com/nodejs/build/issues/2227#issuecomment-608334574 | |
| 40 | 30 | test-crypto-authenticated-stream: SKIP | |
| 41 | - # Windows-specific test | ||
| 42 | - test-path-posix-relative-on-windows: SKIP | ||
| 43 | 31 | ||
| 44 | 32 | [$system==ibmi] | |
| 45 | - # Windows-specific test | ||
| 46 | - test-path-posix-relative-on-windows: SKIP | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,14 @@ const failures = []; | |||
| 9 | 9 | const slashRE = /\//g; | |
| 10 | 10 | const backslashRE = /\\/g; | |
| 11 | 11 | ||
| 12 | + const posixyCwd = common.isWindows ? | ||
| 13 | + (() => { | ||
| 14 | + const _ = process.cwd() | ||
| 15 | + .replaceAll(path.sep, path.posix.sep); | ||
| 16 | + return _.slice(_.indexOf(path.posix.sep)); | ||
| 17 | + })() : | ||
| 18 | + process.cwd(); | ||
| 19 | + | ||
| 12 | 20 | const resolveTests = [ | |
| 13 | 21 | [ path.win32.resolve, | |
| 14 | 22 | // Arguments result | |
@@ -31,8 +39,8 @@ const resolveTests = [ | |||
| 31 | 39 | // Arguments result | |
| 32 | 40 | [[['/var/lib', '../', 'file/'], '/var/file'], | |
| 33 | 41 | [['/var/lib', '/../', 'file/'], '/file'], | |
| 34 | - [['a/b/c/', '../../..'], process.cwd()], | ||
| 35 | - [['.'], process.cwd()], | ||
| 42 | + [['a/b/c/', '../../..'], posixyCwd], | ||
| 43 | + [['.'], posixyCwd], | ||
| 36 | 44 | [['/some/dir', '.', '/absolute/'], '/absolute'], | |
| 37 | 45 | [['/foo/tmp.3/', '../tmp.3/cycles/root.js'], '/foo/tmp.3/cycles/root.js'], | |
| 38 | 46 | ], | |
| Back | FazBrowse Home | New Git URL |
0 commit comments