improvement(tests): converge env-flags mocks onto a complete shared mock#5871
Conversation
A bare vi.mock('drizzle-orm') automock colliding with factory mocks of the
same module in a shared worker corrupts vitest's mock registry (upstream
vitest-dev/vitest#10290 / #10145, reproduced in isolation). The global
factory mock already covers this suite.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Suites no longer define local The shared mock is documented as a full stand-in for the real module (all flags plus helpers such as Also drops the only bare Reviewed by Cursor Bugbot for commit 718c7fe. Configure here. |
Greptile SummaryThis PR consolidates environment-flag mocks into one complete shared test module. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "fix(tests): run providers/utils cases se..." | Re-trigger Greptile |
…uential setEnvFlags calls
|
@cursor review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 718c7fe. Configure here.
Summary
@sim/testing's env-flags mock as a COMPLETE, stateful module mock (all 37 flags + 5 functions; live accessors,setEnvFlags()/resetEnvFlagsMock()/envFlagsMockFns) and install it globally in vitest.setup — the old shared mock was itself missing 10 exports and had one wrong defaultvi.mock('@/lib/core/config/env-flags')factories onto it (partial factories were poisoning shared-worker runs: a suite crashed with 'No isHosted export is defined' from another file's partial mock); zero env-flags factories remainvi.mock('mod')automock (drizzle-ormin knowledge search utils) — a bare automock colliding with factory mocks of the same module in a shared worker corrupts vitest's mock registry (reproduced in isolation; upstream Module mocking regression from Vitest 3 to Vitest 4 vitest-dev/vitest#10290 / #10145)Type of Change
Testing
Full apps/sim suite green locally (13732/13733; sole failure is the known local ripgrep dependency, green in CI). All 66 migrated files re-verified together (1729/1729). tsc clean in apps/sim and packages/testing; biome clean.
Checklist