From 6dcffdc6ad1b5910517f6cfaa244e37679dd3f65 Mon Sep 17 00:00:00 2001 From: Frank Steiler Date: Mon, 15 Jun 2026 19:39:45 +0200 Subject: [PATCH] chore(test): adopt Jest 30.4.0 workerGracefulExitTimeout and --collectTests - Add `workerGracefulExitTimeout: 2000` to the top-level Jest config; the 500 ms default is too tight for jsdom/file-watcher cleanup in the resource-constrained sandbox and produces spurious force-kill warnings. - Add `test:collect` and `test:collect:json` npm scripts using Jest 30.4.0's `--collectTests` flag to enumerate all test suites and names without executing them. - Document `test:collect` in CLAUDE.md Common Commands table. Fixes #1573 Co-Authored-By: Claude qa-integration-tester (Sonnet 4.5) --- CLAUDE.md | 1 + jest.config.ts | 6 ++++++ package.json | 2 ++ 3 files changed, 9 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 0e70caed8..ba5232c0b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -439,6 +439,7 @@ npm run dev # Start server (port 3000) + client dev server (po | `npm run dev:client` | Start only the Webpack dev server | | `npm run build` | Build all packages (shared -> client -> server) | | `npm test` | Run all tests | +| `npm run test:collect` | List all tests (suites + names) without executing them | | `npm run lint` | Lint all code | | `npm run format` | Format all code | | `npm run typecheck` | Type-check all packages | diff --git a/jest.config.ts b/jest.config.ts index 566fddbfc..3bf98fbf0 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -40,6 +40,12 @@ const config: Config = { // Locally, use up to 2 workers and recycle when heap exceeds 512 MB. // CI auto-detects workers (GitHub Actions sets CI=true). ...(isCI ? {} : { maxWorkers: 2, workerIdleMemoryLimit: '512M' }), + // Give workers 2 s to release file-watchers and jsdom handles after tests + // complete before force-killing. The 500 ms default is too tight in the + // resource-constrained sandbox and produces spurious "worker failed to exit + // gracefully" warnings; 2000 ms lets legitimate cleanup finish while still + // bounding true hangs. + workerGracefulExitTimeout: 2000, projects: [ { ...baseConfig, diff --git a/package.json b/package.json index fb93019c0..5880178d2 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,8 @@ "test": "node --experimental-vm-modules node_modules/.bin/jest", "test:watch": "node --experimental-vm-modules node_modules/.bin/jest --watch", "test:coverage": "node --experimental-vm-modules node_modules/.bin/jest --coverage", + "test:collect": "node --experimental-vm-modules node_modules/.bin/jest --collectTests", + "test:collect:json": "node --experimental-vm-modules node_modules/.bin/jest --collectTests --json", "test:e2e": "npm test -w e2e", "test:e2e:shard": "npm run test:shard -w e2e", "test:e2e:smoke": "npm run test:smoke -w e2e",