chore: add --changedSince base SHA to Jest in CI#110568
Conversation
4ac580b to
e489c3c
Compare
e489c3c to
2f37360
Compare
2f37360 to
f44f300
Compare
f44f300 to
78fe0de
Compare
78fe0de to
cbcf12f
Compare
cbcf12f to
9e2e96f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| if (allTests.length === 0) { | ||
| return []; | ||
| } | ||
|
|
There was a problem hiding this comment.
Shard balancing uses unfiltered total, breaking distribution
Medium Severity
speculatedSuiteDuration is computed from the full testStats (all ~1,861 suites), but the new filtering at lines 143–146 correctly restricts the tests Map to only the allTests subset from --changedSince. Since targetDuration is massively inflated relative to the actual filtered tests' total duration, the balancing loop stuffs every test into the first shard while shards 1–3 get nothing. This defeats parallelization for any small-to-medium --changedSince result set.
Additional Locations (1)
There was a problem hiding this comment.
Hmm, interesting. I don't think parallelization at those result set scales really matters much, right? Running 10 suites vs 100 is pretty quick.
|
on package.json or those kinds of changes would it know to run the entire suite? |
1d52432 to
6138aa6
Compare
1252595 to
14d8c0e
Compare
Made-with: Cursor
The git diff for the non-frontend file guard was comparing against HEAD (the synthetic merge commit) instead of HEAD^2 (the PR branch tip). This included base branch changes in the diff, causing false positives that unnecessarily forced full test runs. Made-with: Cursor
14d8c0e to
5c9ae7e
Compare


"Why run many unit test when few do trick?" – Kevin Malone, Senior Frontend Developer
Changes the Frontend > Jest jobs to use Jest's
--changedSinceoption when possible. That has them only run test suites that are impacted by the changes in a PR based on the module dependency graph. Jest requires the commit history since the base commit, so this adds a second "run only necessary Jest tests" flow infrontend-optional.yml. Specifically, that:100, which should get most PRs' commits pretty quicklyMERGE_BASEusinggit merge-baseMERGE_BASEif the PR touches any non-static/files.MERGE_BASEcould be computed, passes it as a process env var to test scripts for use as Jest'schangedSinceMERGE_BASEcouldn't be computed, the new "run only necessary Jest tests" flow is skippedMy plan (thanks to reviewer feedback) is to keep this running as a secondary, optional test flow on
masterfor a couple weeks. If all seems well, we can remove the original "run all Jest tests" logic and only run the "run only necessary Jest tests" logic.The following PRs exercise different scales of changes:
For low-connectivity changes (isolated components, feature-specific views),
--changedSinceprovides pretty great savings: even 100 low-connectivity files only trigger ~10% of suites. Medium-connectivity files still scale pretty well, with 100 files hitting ~29%. High-connectivity files (widely-imported utils, core components) sadly trigger 85-90% of suites, which is inevitable given Sentry's highly connected module graph.Fixes ENG-7103