Conversation
b0eb52a to
fd7526c
Compare
| absolute: true, | ||
| ignore: ignoredDirsGlobs, | ||
| nodir: true, | ||
| onlyFiles: true, |
There was a problem hiding this comment.
onlyFiles: true is the default, but I've kept it for explicitness.
fd7526c to
9f7de94
Compare
lydell
left a comment
There was a problem hiding this comment.
Thank you so much! ⭐
I think I have to do some manual tests on Windows before I dare merging this.
| .flatMap((filePath) => | ||
| filePath.endsWith('/') ? findAllElmFilesInDir(filePath) : filePath | ||
| ); | ||
| return globSync(pattern, { |
There was a problem hiding this comment.
Note to self: there a big comment above about glob@8 and Windows and backslashes. Try it out on Windows to see how it behaves in tinyglobby, and remove or update the code/comment?
There was a problem hiding this comment.
It’s needed: 7814ff7 (#647)
Updated the comment: 46ca4aa (#647)
| onlyFiles: false, | ||
| }).flatMap((filePath) => | ||
| // Directories have their path end with `/` | ||
| filePath.endsWith('/') ? findAllElmFilesInDir(filePath) : filePath |
There was a problem hiding this comment.
Note to self: Does it end with a slash on Windows? We don’t seem to have test coverage for this condition being true.
There was a problem hiding this comment.
Added test case: 36cdb47 (#647)
Btw, that test was failing on master – see #648. But it passed when installing glob 8 instead of 10. Another breakage by glob 🙈
This should I think fix the support for Node.js v12 (and fixes #646)
Note: I haven't tested it as thoroughly as I'd like to yet, but it seems to work well so far.
The packages are relatively interchangeable, though the options change; Here is the documentation for each:
nodirbecomesonlyFiles: truenocasebecomescaseSensitiveMatch(but inverted)I could not find an equivalent to glob's
mark(Append a / on any directories matched) but that is the default behavior fortinyglobbyanyway.From what I can tell, these are the paths through which globbing is used (My understanding of what is happening at least):
In
resolveGlobs, we look for test files. By default we look for<root>/tests, but that can be overridden by CLI arguments (elm-test otherDir/ tests/SpecificTest.elm).We first iterate through that list to understand which each of these paths exist or not. If it exists, we defer tofindAllElmFilesInDirif it's a directory, and just take the file it it's a file. If it does not exist, then it's likely a glob (elm-test "**/*Test.elm" "te*ts/", which we defer toresolveCliArgGlobwhere we apply the glob. For every directory, we then again defer to findAllElmFilesInDir`.In findAllElmFilesInDir`, we use globbing to find all contained Elm files.