Files
sim/.github
Waleed d67e02f978 perf(tests): skip jest-dom in node-environment test files (#6088)
`vitest.setup.ts` loaded `@testing-library/jest-dom/vitest` unconditionally,
so all 1,219 test files paid for it. jest-dom only registers DOM matchers
(`toBeInTheDocument`, `toBeVisible`, ...), which are useless without a
document — and 985 of those files declare `@vitest-environment node`.

Guarding the import on `typeof document !== 'undefined'` loads it for exactly
the files that can use it. All 7 files that actually call a jest-dom matcher
are explicitly `@vitest-environment jsdom`, so none loses anything; verified
by running them.

Measured locally, same machine, full suite:

  baseline   Duration 179.47s  (setup 367.13s aggregate)
  guarded    Duration 165.78s  (setup 252.72s aggregate)

7.6% off the suite, 31% off aggregate setup time. On a node-only subset
(50 files, n=3 each) it is 21%: 2.75s -> 2.16s median. Identical results
either way: 1225 files / 16184 tests pass, plus one failure that reproduces
on unmodified staging (cloud-review-tools.test.ts cannot find `rg` from its
spawned python3 locally; CI installs ripgrep explicitly and it passes there).

Also fixes two pieces of CI documentation that claimed more than the code
does — the same class of thing #6076 cleaned up:

- The step was named "Run tests with coverage" but runs `bun run test` =
  `vitest run`, with no `--coverage` anywhere.
- The Codecov upload reads `apps/sim/coverage`, which nothing generates
  (vitest.config.ts declares no coverage provider). It uploads nothing and
  still reports success in ~1s because `fail_ci_if_error: false`. Annotated
  rather than deleted, since whether to enable coverage or drop the step is
  a call for the team, not a side effect of a perf change.
2026-07-29 20:16:27 -07:00
..