fix(front): run the browser tests on as many pages as --maxWorkers, collecting each one's garbage #575

Closed
admin-amaurycoudr wants to merge 1 commit from fix/front-browser-pages into main

Summary

 browser project (Vitest 4.1, Playwright Chromium)
-  pages: one per CPU, whatever --maxWorkers says      # 4 on the CI VPS
-  each page keeps every file it ran as garbage until V8 runs short
+  pages: as many as --maxWorkers (1 in CI)            # pagesFollowMaxWorkers plugin
+  beforeAll: collectGarbage (CDP HeapProfiler.collectGarbage)
   MSW worker
-    starts on import
+    starts at the file's first hook, still one per file, in error mode

vitest.config.test.ts pins that the browser project takes the run's --maxWorkers.

Evidence

Front suite in a container capped like CI, cgroup memory.peak:

  • Before: the run stopped after 23 of 81 files with an error, at 2.4 GiB. In CI: at 3 GiB the tests starved and timed out (GitLab pipeline 328, Forgejo run 3); at 6 GiB the kernel OOM-killed chrome-headless mid-run (Forgejo run 5).
    After: 82/82 files, 1631/1631 tests pass, peak about 2.0 GiB.
  • Gate: the five commands green locally.

Merge Danger

Door: two-way

Blast Radius: front tests

Test setup only, no app code. A local pnpm test without --maxWorkers keeps Vitest's own page count. #573 and #574 rebase onto this once it lands, so their front-test goes green.

## Summary ```diff browser project (Vitest 4.1, Playwright Chromium) - pages: one per CPU, whatever --maxWorkers says # 4 on the CI VPS - each page keeps every file it ran as garbage until V8 runs short + pages: as many as --maxWorkers (1 in CI) # pagesFollowMaxWorkers plugin + beforeAll: collectGarbage (CDP HeapProfiler.collectGarbage) MSW worker - starts on import + starts at the file's first hook, still one per file, in error mode ``` `vitest.config.test.ts` pins that the browser project takes the run's `--maxWorkers`. ## Evidence Front suite in a container capped like CI, cgroup `memory.peak`: - **Before:** the run stopped after 23 of 81 files with an error, at 2.4 GiB. In CI: at 3 GiB the tests starved and timed out (GitLab pipeline 328, Forgejo run 3); at 6 GiB the kernel OOM-killed `chrome-headless` mid-run (Forgejo run 5). **After:** 82/82 files, 1631/1631 tests pass, peak about 2.0 GiB. - Gate: the five commands green locally. ## Merge Danger **Door:** two-way **Blast Radius:** front tests Test setup only, no app code. A local `pnpm test` without `--maxWorkers` keeps Vitest's own page count. #573 and #574 rebase onto this once it lands, so their `front-test` goes green.
fix(front): run the browser tests on as many pages as --maxWorkers, collecting each one's garbage
Some checks failed
ci / plan (pull_request) Successful in 9s
ci / checks (pull_request) Failing after 1m52s
ci / front-test (pull_request) Failing after 8m30s
ci / e2e (pull_request) Failing after 4m12s
preview-close / remove (pull_request) Successful in 8s
ci / reuse-image (pull_request) Has been skipped
ci / build-workspace (pull_request) Has been skipped
ci / build-image (pull_request) Has been skipped
ci / preview (pull_request) Has been skipped
ci / preview-screenshots (pull_request) Has been skipped
ci / production (pull_request) Has been skipped
ci / comment (pull_request) Failing after 3s
2708af5353
Vitest 4.1 hands --maxWorkers to its node pools only, so the browser project opened a page per CPU
whatever the run asked, and each page kept the files it had run as garbage until V8 ran short. In
CI that grew past the job's cap: at 3 GiB the tests starved and timed out, at 6 GiB the kernel
killed Chromium mid-run (Forgejo run 5).

- A plugin hands the run's --maxWorkers to the browser project, and a test pins it.
- A browser command collects the page's garbage before each file.
- MSW's worker starts at the file's first hook rather than on import.

Measured in a container: the whole front suite peaks at about 2.0 GiB, and all 82 files pass;
before, the run stopped after 23 files at 2.4 GiB.
Author
Owner

Combined into #574, which carries this commit on top of #573's artifact fix that this run lacked.

Combined into #574, which carries this commit on top of #573's artifact fix that this run lacked.
Some checks failed
ci / plan (pull_request) Successful in 9s
ci / checks (pull_request) Failing after 1m52s
Required
Details
ci / front-test (pull_request) Failing after 8m30s
Required
Details
ci / e2e (pull_request) Failing after 4m12s
Required
Details
preview-close / remove (pull_request) Successful in 8s
ci / reuse-image (pull_request) Has been skipped
ci / build-workspace (pull_request) Has been skipped
ci / build-image (pull_request) Has been skipped
ci / preview (pull_request) Has been skipped
ci / preview-screenshots (pull_request) Has been skipped
ci / production (pull_request) Has been skipped
ci / comment (pull_request) Failing after 3s

Pull request closed

Sign in to join this conversation.
No description provided.