Title: perf(tests): skip jest-dom in node-environment test files by waleedlatif1 · Pull Request #6088 · simstudioai/sim · GitHub
Open Graph Title: perf(tests): skip jest-dom in node-environment test files by waleedlatif1 · Pull Request #6088 · simstudioai/sim
X Title: perf(tests): skip jest-dom in node-environment test files by waleedlatif1 · Pull Request #6088 · simstudioai/sim
Description: Summary Lint and Test is now the CI critical path (184s vs Build App's 147s after #6080), and 143s of that 184s is the test suite. This takes ~8% off it. 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. Where the time actually goes From the CI run's own vitest summary (aggregate across workers, so it exceeds wall clock): Duration 141.02s (transform 101.32s, setup 123.76s, import 686.00s, tests 55.18s, environment 15.07s) Actual test execution is 55s. The rest is per-file overhead — and setup is the part a global setup file controls. Measured, same machine, full suite Duration setup (aggregate) baseline 179.47s 367.13s guarded 165.78s 252.72s 7.6% off the suite, 31% off aggregate setup. On a node-only subset (50 files, n=3 each) it's 21% — 2.75s → 2.16s median. Nothing loses a matcher All 7 files that actually call a jest-dom matcher are explicitly @vitest-environment jsdom, so typeof document !== 'undefined' is true for exactly those. Verified by running them: 4 files / 7 tests pass. Full suite is identical either way — 1225 files / 16184 tests pass. The one failure (cloud-review-tools.test.ts) reproduces on unmodified staging: its spawned python3 can't find rg on macOS. CI installs ripgrep explicitly and it passes there. Two CI docs that claimed more than the code does Same class as #6076, found while tracing this: 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. So its green tick has never meant coverage was published. I annotated rather than deleted the Codecov step: @vitest/coverage-v8 is installed, so enabling coverage is possible, but instrumentation costs test time and nothing gates on the result. That's a call for you, not a side effect of a perf change — happy to either wire it up or drop the step. Not addressed here import is the real monster — 686s aggregate vs 55s of actual tests. That's module graph cost per test file, the same root cause as the tool registry being 68–78% of every route's graph. vitest.setup.ts already globally mocks @/blocks/registry; doing the same for @/tools/registry could be large, but it would silently change behaviour for any test that needs real tools, across 1,219 files. Needs its own measured, scoped change. Type of Change Performance Improvement (CI documentation accuracy) Testing Full suite run both ways on the same machine (numbers above); the 7 jest-dom-dependent files run explicitly; actionlint clean; biome clean.
Open Graph Description: Summary Lint and Test is now the CI critical path (184s vs Build App's 147s after #6080), and 143s of that 184s is the test suite. This takes ~8% off it. vitest.setup.ts loaded @testing-library...
X Description: Summary Lint and Test is now the CI critical path (184s vs Build App's 147s after #6080), and 143s of that 184s is the test suite. This takes ~8% off it. vitest.setup.ts loaded @testing-lib...
Opengraph URL: https://github.com/simstudioai/sim/pull/6088
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f62ba3b9-b414-5e62-8e57-c59d7f037d6a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B212:15B52D:5F47B0:88B8CF:6AFB4123 |
| html-safe-nonce | bfc2e6cd9eb5df24b47dc50801212905bea6e3ec6118ea3af893969bb37f8ca6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjEyOjE1QjUyRDo1RjQ3QjA6ODhCOENGOjZBRkI0MTIzIiwidmlzaXRvcl9pZCI6IjQ3MTMzNTA4MzM4NzYxODk0NzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ad97bd202174c9e656379f97ca7ace8deeecb137e92027318aff80e999d50ef5 |
| hovercard-subject-tag | pull_request:4165924293 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6088/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Summary Lint and Test is now the CI critical path (184s vs Build App's 147s after #6080), and 143s of that 184s is the test suite. This takes ~8% off it. vitest.setup.ts loaded @testing-library... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | d849b928f455c800985398e7f1b659425adb312a5fa14fba5d9a14e62e9fe5dd |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a6c2f87cbcb6414452377b4967858ed6a66f1109 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width