Repository navigation
ref(tests): Share test tooling across workspace packages - #127153
Conversation
fe92d93 to
0020ec8
Compare
0020ec8 to
dffcfa2
Compare
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
# Conflicts: # package.json # pnpm-lock.yaml
| if [ "$scope" == "scoped" ]; then | ||
| # shellcheck disable=SC2086 | ||
| JEST_TESTS="$(pnpm exec jest --listTests --json --findRelatedTests $FRONTEND_ALL_FILES | jq '.')" | ||
| JEST_TESTS="$(pnpm exec sentry-test --listTests --json --findRelatedTests $FRONTEND_ALL_FILES | jq '.')" |
There was a problem hiding this comment.
note: sentry-test is the executable exposed from the test/js package.
There was a problem hiding this comment.
Part of me thinks we should roll these all up into a vite-plus like CLI eventually...
| })), | ||
| })); | ||
|
|
||
| jest.mock('@stripe/stripe-js', () => ({ |
There was a problem hiding this comment.
moved to the getsentry jest setup
| '@sentry-internal/global-search', // jest.mock does not count as an import. | ||
| '@tanstack/react-pacer', // loaded with requireActual | ||
| 'echarts-for-react', // jest.mock in setup.ts |
There was a problem hiding this comment.
note: I have a PR up in knip to address this:
| "sentry-fixture": "workspace:@sentry-internal/sentry-test@*", | ||
| "sentry-test": "workspace:@sentry-internal/sentry-test@*", |
There was a problem hiding this comment.
note: I’m not a fan of this, but it’s what currently produces the least amount of changes. We import from both sentry-fixtures and sentry-test, but they point to the same package.
Ideally, we’d split that up into two packages or unify the imports to just be sentry-test and maybe sentry-test/fixtures/*. But both mean changing lots of entry points, so I’m leaving that for a follow-up
|
bugbot run |
# Conflicts: # package.json # pnpm-lock.yaml
|
bugbot run |
| }, | ||
| "scripts": { | ||
| "test": "node ../../../scripts/test.js --config jest.config.mjs", | ||
| "test": "NODE_ENV=test jest --config jest.config.mjs", |
There was a problem hiding this comment.
is it intentional that these aren't using --watch like the application packages?
There was a problem hiding this comment.
I’ll streamline this in a follow-up. adding --watch will likely mean more changes in the CI script to take it away again. I’m not sure who actually runs test locally in watch mode? So maybe it’s best to just remove this and tell AI to append --watch if it wants this.
| - static/packages/icons | ||
| - static/packages/scraps | ||
| - tests/js | ||
| - tests/js/getsentry-test |
There was a problem hiding this comment.
l: i find the nesting of getsentry-test a bit odd
There was a problem hiding this comment.
yes, me too. I just didn’t want to move all the files we currently have. can do that in a follow-up
| if [ "$scope" == "scoped" ]; then | ||
| # shellcheck disable=SC2086 | ||
| JEST_TESTS="$(pnpm exec jest --listTests --json --findRelatedTests $FRONTEND_ALL_FILES | jq '.')" | ||
| JEST_TESTS="$(pnpm exec sentry-test --listTests --json --findRelatedTests $FRONTEND_ALL_FILES | jq '.')" |
There was a problem hiding this comment.
Part of me thinks we should roll these all up into a vite-plus like CLI eventually...
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.
Reviewed by Cursor Bugbot for commit b3d6725. Configure here.

Icons and Scraps now use a shared private test-utils package for the Jest runner, jsdom environment, matchers, React Testing Library APIs, and style assertions. The package owns these dependencies, which removes repeated declarations from both consumers and moves jsdom and the abstract Jest jsdom environment out of the root manifest.
The typed Jest configuration accepts consumer setup and overrides. Theme wrappers and app providers stay with their owners, so apps can adopt the same tooling without adding package cycles. The root test command also uses the shared runner.