test(optimize): clean up pnpm v8 and v9 fixture artifacts after tests#1323
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6f7d89d. Configure here.
The pnpm v8/v9 optimize fixture tests run `pnpm install` inside the fixture directories during beforeEach to provision the specific pnpm binary version. The existing afterEach hooks only reset tracked files (`git checkout HEAD -- .`) but left untracked `node_modules/` and `.cache/` directories behind, polluting the working tree. This caused two problems: 1. Running `git add -A` (or relying on pre-commit hooks that do) would accidentally stage thousands of untracked fixture artifacts. 2. The pnpm9 fixture install was silently failing (swallowed by `try/catch` + `stdio: 'ignore'`), so pnpm9 tests fell back to the system pnpm rather than testing against pnpm v9. Fix: - Import `trash` and remove `node_modules/` + `.cache/` in both beforeEach (to clean up after prior aborted runs) and afterEach (to keep the fixture clean going forward). - Use `Promise.all` for parallel cleanup to avoid `no-await-in-loop` lint warnings. All 4 pnpm-version tests continue to pass and fixtures are now clean after each run.
6f7d89d to
82c5e43
Compare
Martin Torp (mtorp)
approved these changes
May 21, 2026
Contributor
Martin Torp (mtorp)
left a comment
There was a problem hiding this comment.
Good catch ✅
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.

The pnpm v8/v9 optimize fixture tests run
pnpm installinside the fixture directories duringbeforeEachto provision the specific pnpm binary version. The existingafterEachhooks only reset tracked files (git checkout HEAD -- .) but left untrackednode_modules/and.cache/directories behind, polluting the working tree for both pnpm v8 and pnpm v9 fixtures.This caused two problems for both fixtures:
git add -A(or relying on pre-commit hooks that do) would accidentally stage thousands of untracked fixture artifacts.try/catch+stdio: 'ignore'), so pnpm9 tests fell back to the system pnpm rather than testing against pnpm v9.Changes
trashand removenode_modules/+.cache/in bothbeforeEach(to clean up after prior aborted runs) andafterEach(to keep the fixture clean going forward) for both pnpm8 and pnpm9 fixtures.Promise.allfor parallel cleanup to avoidno-await-in-looplint warnings.Verification
package.jsonandpnpm-lock.yamlremain).Note
Low Risk
Low risk: test-only changes that add cleanup of
node_modules/.cachein fixtures; main impact is slightly longer test setup and potential environment-specific filesystem deletion behavior.Overview
Keeps the
pnpm8/pnpm9optimize fixture tests from leaving behind untracked install artifacts by deletingnode_modules/and.cache/in bothbeforeEach(cleanup from prior runs) andafterEach(post-test cleanup).The tests now use
trashand run cleanup in parallel viaPromise.all, while still resetting tracked files viagit checkout.Reviewed by Cursor Bugbot for commit 6f7d89d. Configure here.