Commit 82c5e43
committed
test(optimize): clean up pnpm fixture artifacts after tests
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.1 parent b6c3411 commit 82c5e43
1 file changed
Lines changed: 35 additions & 4 deletions
Lines changed: 35 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
| |||
54 | 63 | | |
55 | 64 | | |
56 | 65 | | |
57 | | - | |
| 66 | + | |
58 | 67 | | |
59 | 68 | | |
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
64 | 80 | | |
65 | 81 | | |
66 | 82 | | |
| |||
161 | 177 | | |
162 | 178 | | |
163 | 179 | | |
164 | | - | |
| 180 | + | |
| 181 | + | |
165 | 182 | | |
166 | 183 | | |
167 | 184 | | |
168 | 185 | | |
169 | 186 | | |
170 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
171 | 195 | | |
172 | 196 | | |
173 | 197 | | |
| |||
188 | 212 | | |
189 | 213 | | |
190 | 214 | | |
191 | | - | |
| 215 | + | |
192 | 216 | | |
193 | 217 | | |
194 | 218 | | |
195 | 219 | | |
196 | 220 | | |
197 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
198 | 229 | | |
199 | 230 | | |
200 | 231 | | |
| |||
0 commit comments