Skip to content

chore(test): adopt Jest 30.4 workerGracefulExitTimeout + --collectTests scripts#1697

Merged
steilerDev merged 1 commit into
betafrom
chore/1573-jest-test-tooling
Jun 15, 2026
Merged

chore(test): adopt Jest 30.4 workerGracefulExitTimeout + --collectTests scripts#1697
steilerDev merged 1 commit into
betafrom
chore/1573-jest-test-tooling

Conversation

@steilerDev

Copy link
Copy Markdown
Owner

Summary

  • workerGracefulExitTimeout: 2000 added to the top-level Jest config object (alongside the existing maxWorkers/workerIdleMemoryLimit spread). The 500 ms default causes spurious "worker failed to exit gracefully" warnings in the resource-constrained sandbox when jsdom and file-watcher handles take slightly longer to release; 2000 ms lets legitimate cleanup finish while still bounding true hangs.
  • test:collect / test:collect:json scripts added to root package.json, using Jest 30.4.0's new --collectTests flag. These enumerate all test suites and test names in a hierarchical tree without executing any tests — useful for auditing coverage and generating machine-readable test inventories.
  • CLAUDE.md Common Commands table updated with a single test:collect row.

Validation

  • Ran node --experimental-vm-modules node_modules/.bin/jest shared/src/types/user.test.ts --maxWorkers=1: no "Unknown option" warning for workerGracefulExitTimeout; 16 tests passed.
  • Full shared suite (10 suites, 259 tests): zero config-validation warnings.
  • --collectTests flag accepted by installed 30.4.2; prints hierarchical tree, exits 0, does not execute tests.
  • --collectTests --json emits valid JSON with numPendingTests: 16, numPassedTests: 0, exits 0.

Notes

  • No production code changed (nothing under server/, client/, shared/, e2e/). No new unit tests required — this is a test-tooling-only change.
  • workerGracefulExitTimeout is a root/global config option per Jest 30.4 docs; it is placed on the top-level config object, not inside baseConfig.
  • The flag form --collectTests (camelCase) was used; it is accepted by 30.4.2.

Test plan

  • CI Quality Gates pass (typecheck + test + build)
  • No "Unknown option" warnings in CI Jest output

Fixes #1573

🤖 Generated with Claude Code

@steilerDev steilerDev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[security-engineer] Security review — no findings.

Checklist:

  • No new dependencies added (package-lock.json unchanged)
  • New npm scripts invoke only jest --collectTests (test discovery, no execution, no network/credential surface)
  • No shell injection vector: scripts use the same node --experimental-vm-modules node_modules/.bin/jest invocation pattern already established in root package.json
  • workerGracefulExitTimeout: 2000 is a Jest worker cleanup timeout; no security impact
  • CLAUDE.md change is a documentation table row only

Verdict: APPROVED. No security concerns in this test-tooling-only change.

@steilerDev steilerDev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[product-owner] Requirements-coverage review against #1573.

Scope verdict: in-scope changes adequately address the issue. Both stated opportunities are delivered:

  1. --collectTests — exposed via test:collect / test:collect:json scripts (root package.json) + CLAUDE.md Common Commands row. ✅
  2. workerGracefulExitTimeout: 2000 — added to top-level Jest config, above the 500 ms default. ✅

The CI-sanity-step integration for --collectTests was explicitly deferred. I agree this is a reasonable follow-up, not a required part of #1573 — the issue framed it as making the capability "useful for CI sanity checks," and the scripts make that capability available now. A CI wiring step can be a separate enhancement issue if/when we want it. No functional AC gap.

BLOCKING — out-of-scope dependency downgrades (must fix before merge). The PR branch is based on a stale beta (merge-base 9b21257, 17:21) that predates the dependency-bump PR #1695 (merged 19:36). As a result the current PR diff origin/beta..HEAD reverts 8 dependency upgrades that already landed on beta:

  • react / react-dom 19.2.7 → 19.2.6
  • react-router-dom 7.17.0 → 7.15.1
  • i18next 26.3.1 → 26.2.0
  • react-konva 19.2.5 → 19.2.4
  • @types/react 19.2.17 → 19.2.14
  • plus docs/package.json and server/package.json downgrades and a ~397-line package-lock.json churn

These are not intended by this story (a test-tooling-only change should touch zero package.json dependency entries and zero lockfile lines). Merging as-is would regress production dependencies and undo #1695.

Required action: rebase the branch onto current origin/beta and force-push. After rebase, the diff should reduce to exactly jest.config.ts, the two scripts in root package.json, and the CLAUDE.md row — no client/, docs/, server/ package.json changes and no lockfile churn. Re-run CI after rebase.

Once the diff is clean, this is an approve from a requirements standpoint — the delivered scope fully satisfies #1573.

@steilerDev

Copy link
Copy Markdown
Owner Author

[product-architect] Architecture review — APPROVE (proportionate to a test-tooling change).

Actual change (commit 37cf48fa, 3 files / +9 lines) is exactly as scoped:

  • workerGracefulExitTimeout: 2000 in jest.config.ts — verified as a real Jest 30.4.2 global config option (default 500, matches the inline comment). Correctly placed at top level outside projects (worker lifecycle is global, not per-project). @jest/types types it as workerGracefulExitTimeout?: number, so typecheck is safe. The 2000ms value is well-reasoned for the resource-constrained sandbox.
  • test:collect / test:collect:json scripts — --collectTests is a real Jest 30.4.2 CLI flag; scripts correctly reuse the --experimental-vm-modules ESM wrapper used by the other test:* scripts.
  • One CLAUDE.md Common Commands row.

Fully aligned with ADR-005 (Jest 30.x). No production code, schema, or API-contract impact.

Non-blocking process note: the diff vs origin/beta shows phantom dependency downgrades (React 19.2.7→19.2.6, react-router-dom 7.17.0→7.15.1, sharp, ical-generator, ~397 lines of lockfile churn). These are not authored changes — the branch is 1 commit behind beta (Dependabot bump #1695 merged after this branch was cut), so the bumps render as reversed in the diff. A rebase onto beta makes them vanish. Squash-merge onto beta makes this low-risk, but a rebase is cleaner and avoids reviewer confusion.

…tTests

- 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) <[email protected]>
@steilerDev steilerDev force-pushed the chore/1573-jest-test-tooling branch from 37cf48f to 6dcffdc Compare June 15, 2026 17:59
@steilerDev steilerDev merged commit 7e53bfe into beta Jun 15, 2026
29 of 31 checks passed
@steilerDev steilerDev deleted the chore/1573-jest-test-tooling branch June 15, 2026 18:12
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.8.0-beta.16 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant