glob based matching broken on Windows
Marcus10110 opened this issue · 0 comments
Quite simply, * and ** based matches fail to work on windows.
Ironically, this actually prevents the tests from running on windows, because the '*' character is used to find tests.
To reproduce the failure, simply modify the jake file to explicitly run the test file my name by editing this line:
Line 2 in 6cf28fa
and replace with this.testFiles.include('test/filelist.js');
Once the tests actually run on windows, the following test output will be displayed:
> yarn test
yarn run v1.22.17
$ jake test
Starting 'test'...
jake aborted.
AssertionError [ERR_ASSERTION]: 0 == 2
at Task.path separator can be used by exclude (C:\Users\markg\Software\filelist\test\filelist.js:32:12)
at Task.action (C:\Users\markg\Software\filelist\node_modules\jake\lib\test_task.js:173:22)
at Task.run (C:\Users\markg\Software\filelist\node_modules\jake\lib\task\task.js:325:29)
at processImmediate (internal/timers.js:464:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The root problem is the use of path.normalize
here, on the query, right before passing the pattern to minimatch:
Line 200 in 6cf28fa
A quick test shows removing this normalization causes tests to pass. However, I think normalization is still needed for handling other path fixups, and instead the same fixup used by globSync
should be used after normalization to switch back to Unix path separators.
I'll get a PR open shortly.