Migrate patterns-glob.js tests#37
Conversation
Test file: https://github.com/prettier/prettier/blob/92ac6d036e5b226441584e9f48876ae2f7c6a6a1/tests/integration/__tests__/patterns-glob.js Fixtures: https://github.com/prettier/prettier/tree/92ac6d036e5b226441584e9f48876ae2f7c6a6a1/tests/integration/cli/patterns-glob Snapshots: https://github.com/prettier/prettier/blob/92ac6d036e5b226441584e9f48876ae2f7c6a6a1/tests/integration/__tests__/__snapshots__/patterns-glob.js.snap
Tested with a locally built `tiny-readdir-glob` with a fix for this edge case. Snapshot needed to be adjusted as it seems we're returning the results alphabetically in v4.
When explicitly targeting a file in a forbidden directory (e.g. `.svn`), we don't want to exclude it from the results.
|
@fabiospampinato Removed one test per our discussion in fabiospampinato/tiny-readdir-glob#4. This should be ready to land now. |
…patterns-glob-tests
|
This seems good, merging it now 👍 Thanks! The only detail that seems maybe a bit problematic is matching directories that start with So I think extending that logic for directories too may make sense, mainly for the sake of changing as little as possible from v3 if the fix requires little code. I'll play with it after merging 👍 |
|
Implemented the fake negated glob thing here. |
Works on #19.
Depends on fabiospampinato/tiny-readdir-glob#4.
Test file in v3: click!
Fixtures in v3: click!
Snapshots in v3: click!
Most tests passed as is after copying them over.
This test depends on the PR in
tiny-readdir-glob:These tests and their snapshots have been updated to align with the new behavior where we don't want to exclude "forbidden" directories (like
.gitor.svn) when they are targeted explicitly:Unlike
patterns.js, I resisted the urge to make needless changes to the test names, so this should be easier to review.