fix(shouldIgnore): filename normalization should be platform sensitive (#4631)

* fix(shouldIgnore): filename normalization should be platform sensitive

shouldIgnore normalizes the path of the filename prior to running any "only" regexes or functions. The normalization uses "slash", which has some undesirable special cases for non-ASCII characters and longer paths. Changing the normalization behavior to always replace path separators.

There is no real need to add additional tests, because the tests are not run in an environment where path.sep !== '/'.

* Minor style fix to use double quotes.

* Remove conditional for regex replace to keep consistent behavior.

* whitespace [skip ci]
This commit is contained in:
Eric Rozell 2016-10-11 16:02:50 -04:00 committed by Henry Zhu
parent 27ee74ea14
commit c2387f0444

View File

@ -116,7 +116,7 @@ export function shouldIgnore(
ignore: Array<RegExp | Function> = [], ignore: Array<RegExp | Function> = [],
only?: Array<RegExp | Function>, only?: Array<RegExp | Function>,
): boolean { ): boolean {
filename = slash(filename); filename = filename.replace(/\\/g, "/");
if (only) { if (only) {
for (let pattern of only) { for (let pattern of only) {