-
-
Notifications
You must be signed in to change notification settings - Fork 480
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: #468
- Loading branch information
Showing
4 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 8.1 | ||
|
||
- Add `windowsPathsNoEscape` option | ||
|
||
## 8.0 | ||
|
||
- Only support node v12 and higher | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const t = require('tap') | ||
const g = require('../') | ||
|
||
const platforms = ['win32', 'posix'] | ||
const originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform') | ||
for (const p of platforms) { | ||
t.test(p, t => { | ||
Object.defineProperty(process, 'platform', { | ||
value: p, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
}) | ||
t.equal(process.platform, p, 'gut check: actually set platform') | ||
const pattern = '/a/b/c/x\\[a-b\\]y\\*' | ||
const def = new g.Glob(pattern, { noprocess: true }) | ||
const winpath = new g.Glob(pattern, { | ||
windowsPathsNoEscape: true, | ||
noprocess: true, | ||
}) | ||
const winpathLegacy = new g.Glob(pattern, { | ||
allowWindowsEscape: false, | ||
noprocess: true, | ||
}) | ||
const nowinpath = new g.Glob(pattern, { | ||
windowsPathsNoEscape: false, | ||
noprocess: true, | ||
}) | ||
|
||
t.strictSame([ | ||
def.pattern, | ||
nowinpath.pattern, | ||
winpath.pattern, | ||
winpathLegacy.pattern, | ||
], [ | ||
'/a/b/c/x\\[a-b\\]y\\*', | ||
'/a/b/c/x\\[a-b\\]y\\*', | ||
'/a/b/c/x/[a-b/]y/*', | ||
'/a/b/c/x/[a-b/]y/*', | ||
]) | ||
t.end() | ||
}) | ||
} | ||
|
||
Object.defineProperty(process, 'platform', originalPlatform) |