Avoid leaking filesystem watchers in theme tests#8104
Closed
gonzaloriestra wants to merge 1 commit into
Closed
Conversation
Assisted-By: devx/56dcddb4-0bb1-4e96-b794-1bb2fda2cba1
12b6639 to
f005343
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
The Windows Node 22 unit-test shard in #8051 completed all 2,505 assertions successfully, but Vitest reported six unhandled errors afterward:
Two
theme-fs.test.tstests spied onchokidar.watchwhile still creating real filesystem watchers. Their temporary directories could be removed while those watchers remained active, causing asynchronous errors on Windows.WHAT is this pull request doing?
Mocks the Chokidar watcher in both directory-selection tests. The tests continue to verify the paths passed to
watchwithout opening operating-system watchers.This commit is cherry-picked from #8009 with its original authorship preserved. This draft should be closed if #8009 merges first.
How to test your changes?
pnpm --filter @shopify/theme vitest run src/cli/utilities/theme-fs.test.tspnpm --filter @shopify/theme lintpnpm --filter @shopify/theme type-checkgit diff --checkChecklist