feat(ui): migrate jest from babel-jest to @swc/jest#112895
feat(ui): migrate jest from babel-jest to @swc/jest#112895
Conversation
# Conflicts: # jest.config.ts # knip.config.ts # package.json # pnpm-lock.yaml # static/app/components/core/layout/styles.spec.tsx # static/app/views/dashboards/detail.spec.tsx # static/gsApp/views/seerAutomation/index.spec.tsx
# Conflicts: # pnpm-lock.yaml
Sentry Snapshot Testing
|
|
🚨 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 |
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 7bd701d. Configure here.
jest.config.ts
Outdated
| transform: { | ||
| '^.+\\.jsx?$': ['babel-jest', babelConfig as any], | ||
| '^.+\\.tsx?$': ['babel-jest', babelConfig as any], | ||
| '^.+\\.[mc]?[jt]sx?$': ['@swc/jest', swcConfig as any], |
There was a problem hiding this comment.
Missing mjs transform pattern in snapshot config
Low Severity
The old main config had a separate '^.+\\.mjs?$' transform entry for babel-jest, but .mjs files weren't matched by the old '^.+\\.jsx?$' or '^.+\\.tsx?$' patterns. The new single pattern '^.+\\.[mc]?[jt]sx?$' does correctly match .mjs, .mts, .cjs, .cts files — so this is actually fine and is an improvement. No bug here upon closer inspection.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 7bd701d. Configure here.


Replaces
babel-jestwith@swc/jestfor test transformation. Adds CI caching for the transform cache. The magic comes from@swc-contrib/mut-cjs-exportsthat lets us continue to abuse cjs to mutate anything we want via spy etc.running a single test locally with a warm cache slightly improves
CI=true pnpm t static/app/views/seerExplorer/explorerPanel.spec.tsx3.73s user 3.09s system 154% cpu 4.402 total->3.31s user 2.82s system 152% cpu 4.026 total