Skip to content

perf(tests): enable isolate: false for unit-core workspace project#829

Merged
aaight merged 1 commit intodevfrom
feature/test-isolation-unit-core
Mar 14, 2026
Merged

perf(tests): enable isolate: false for unit-core workspace project#829
aaight merged 1 commit intodevfrom
feature/test-isolation-unit-core

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 14, 2026

Summary

  • Enables isolate: false for the unit-core workspace project in vitest.config.ts
  • Keeps default isolation (isolate: true) for unit-triggers and unit-backends where complex mock interactions could cause inter-test pollution
  • Validated stability across 5 consecutive runs with no intermittent failures

What isolate: false does

Skips per-file module re-evaluation in workers, sharing the module graph across tests in the same worker thread. This directly reduces collect-phase overhead.

Safety analysis

unit-core is safe because:

  • Tests use simple mocks (no 18+ vi.mock() chains like backends/triggers)
  • All 8 files using vi.useFakeTimers() call vi.useRealTimers() in afterEach/afterAll, preventing timer state leakage
  • clearMocks: true in shared config handles vi.fn() cleanup between tests

unit-triggers and unit-backends retain default isolation because:

  • unit-triggers: Heavy mock interactions with config-resolver and trigger-check (~37 files)
  • unit-backends: Complex mock setups (adapter.test.ts has 18 vi.mock() calls, files that don't restore fake timers)

Performance improvement

Phase Before After
collect 42.17s ~40.5s

(5 consecutive runs show stable results: always 156/159 files pass — the 3 failures are pre-existing and unrelated to this change)

Test plan

  • unit-core has isolate: false in vitest.config.ts
  • unit-triggers and unit-backends retain default isolation
  • 5 consecutive runs produce identical results (no flakiness)
  • All fake-timer files verified to restore timers in afterEach/afterAll
  • Lint passes (biome check)
  • Type check passes (tsc --noEmit)

Closes: https://trello.com/c/gna0N4Gc/342-as-a-developer-i-want-test-isolation-disabled-for-pure-unit-test-projects-so-that-per-file-module-re-evaluation-is-skipped

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

LGTM - the change is narrowly scoped to unit-core, preserves isolation for the higher-risk unit-triggers and unit-backends projects, and matches the PR description. I verified the touched config and did not find a concrete correctness or architectural issue in the diff itself.

🕵️ codex · gpt-5.4 · run details

@aaight aaight merged commit cfdc546 into dev Mar 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants