Skip to content

ci: Make jest matrix config dynamic for PR runs#116662

Draft
ryan953 wants to merge 9 commits into
masterfrom
ryan953/ci-jest-matrix-dynamic
Draft

ci: Make jest matrix config dynamic for PR runs#116662
ryan953 wants to merge 9 commits into
masterfrom
ryan953/ci-jest-matrix-dynamic

Conversation

@ryan953
Copy link
Copy Markdown
Member

@ryan953 ryan953 commented Jun 2, 2026

Make the matrix config for jest dynamic: only when it's using the changedSince strategy, which only happens with a PR

This helps fix the problem where we have 8 runners being used when we actually intended to only run tests related to the changes at hand.

It doesn't fully improve the PR run though: there are more internal conditions like JEST_TESTS and JEST_LIST_TESTS_INNER which could load up a long list of tests, or the same list of tests in each matrix instance. What this does though it simplify the runtime env, so we're just running everything on one worker node.
We could endup with slower test runs for PRs that codemod/change a lot of files at once, but this is something we can overcome in a followup if we move the call to jest --listTests from inside jest.config.ts, to frontend.yml instead.

@ryan953 ryan953 requested a review from a team as a code owner June 2, 2026 03:30
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

📊 Type Coverage Diff

✅ no issues found

Comment thread .github/workflows/frontend.yml Outdated
Comment thread .github/workflows/frontend.yml Outdated
Comment thread .github/workflows/frontend.yml Outdated
Comment thread .github/workflows/frontend.yml Outdated
Comment thread .github/workflows/frontend.yml Outdated
Comment thread .github/workflows/frontend.yml Outdated
Comment thread .github/workflows/frontend.yml Outdated
Comment thread .github/workflows/frontend.yml Outdated
Comment thread .github/workflows/frontend.yml Outdated
Comment thread .github/workflows/frontend.yml Outdated
Comment thread .github/workflows/frontend.yml Outdated
@ryan953 ryan953 marked this pull request as draft June 2, 2026 05:13
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 12c4119. Configure here.

Comment thread .github/workflows/frontend.yml Outdated
Comment thread .github/workflows/frontend.yml Outdated
frontend_all: ${{ steps.changes.outputs.frontend_all }}
merge_base: ${{ steps.merge_base.outputs.merge_base }}
merge_base_strategy: ${{ steps.merge_base.outputs.merge_base_strategy }}
jest_test_matrix: ${{ steps.merge_base.outputs.jest_test_matrix }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The workflow references steps.merge_base.outputs.jest_test_matrix, but the jest_test_matrix output is generated by a different, unnamed step, causing the reference to fail.
Severity: HIGH

Suggested Fix

Assign an id to the "Jest Matrix Config" step (e.g., id: jest_matrix_config). Then, update the output reference at line 34 to use the correct step ID, for example: jest_test_matrix: ${{ steps.jest_matrix_config.outputs.jest_test_matrix }}.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: .github/workflows/frontend.yml#L34

Potential issue: The "Jest Matrix Config" step generates the `jest_test_matrix` output
but lacks an `id`. The workflow incorrectly attempts to reference this output from the
`merge_base` step at line 34, using `steps.merge_base.outputs.jest_test_matrix`. Since
the `merge_base` step does not produce this output, the expression resolves to an empty
string. This empty string is then passed to `fromJson()` in the downstream
`frontend-jest-tests` job, which will cause the workflow to fail at runtime.

Comment thread .github/workflows/frontend.yml
@ryan953 ryan953 force-pushed the ryan953/ci-jest-matrix-dynamic branch from 12c4119 to 5fed63b Compare June 2, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant