Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
848efcc
test(ui): migrate jest tests to swc-safe mocking
scttcper Feb 20, 2026
6ae34de
test(ui): fix remaining swc mock/spy test init failures
scttcper Feb 20, 2026
b85bc51
test(ui): fix swc failures in saved query and spans/alerts specs
scttcper Feb 20, 2026
46d7a45
test(ui): convert analytics spies to swc-safe module mocks
scttcper Feb 20, 2026
977f681
test(ui): minimize swc migration diff using mut-cjs-exports
scttcper Feb 20, 2026
d2518b1
chore(ui): clean up stale babel references
scttcper Feb 20, 2026
f4b8439
esnext
scttcper Feb 20, 2026
86b0d61
remove ignore
scttcper Feb 20, 2026
85fc0af
test(ui): fix swc regressions for analytics and structuredClone
scttcper Feb 20, 2026
91102df
remove unused export
scttcper Feb 20, 2026
f8e959f
type errors
scttcper Feb 20, 2026
a946795
Merge branch 'master' into scttcper/jest-swc-mocks-ui-tests
scttcper Apr 13, 2026
5ce790a
reload
scttcper Apr 14, 2026
549f008
fix import
scttcper Apr 14, 2026
f302e4d
fix test
scttcper Apr 14, 2026
d0e287e
what is happening
scttcper Apr 14, 2026
782d7ca
attempt to cache swc
scttcper Apr 14, 2026
05e6a32
bump
scttcper Apr 14, 2026
a2811e2
fix test
scttcper Apr 14, 2026
73c0c23
avoid circular import, constant mutation
scttcper Apr 14, 2026
a52df4c
can we not compile emotion?
scttcper Apr 14, 2026
0b937b6
knip
scttcper Apr 14, 2026
b5a528a
you can do anything
scttcper Apr 14, 2026
624fe0f
knip
scttcper Apr 14, 2026
fdf0452
knip
scttcper Apr 14, 2026
e6fce77
Merge branch 'master' into scttcper/jest-swc-mocks-ui-tests
scttcper Apr 14, 2026
a592cf1
rebuild from master
scttcper Apr 14, 2026
94a1bb3
remove more references
scttcper Apr 14, 2026
7bd701d
swc group
scttcper Apr 14, 2026
6a58560
don't think we need type casting
scttcper Apr 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ pyproject.toml @getsentry/owners-pytho
vercel.json @getsentry/owners-js-build
/.github/workflows/frontend.yml @getsentry/owners-js-build
/.github/file-filters.yml @getsentry/owners-js-build
babel.config.* @getsentry/owners-js-build
build-utils/ @getsentry/owners-js-build
eslint.config.ts @getsentry/owners-js-build
jest-balance.json @getsentry/owners-js-build
Expand Down
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ updates:
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups
groups:
# The name of the group, it will be used in PR titles and branch
babel-dependencies:
swc-dependencies:
patterns:
- '@babel/*'
- '@swc/*'
sentry-dependencies:
patterns:
- '@sentry/core'
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ jobs:

- uses: ./.github/actions/setup-node-pnpm

- name: jest transform cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: |
.cache/jest
~/.cache/swc
key: jest-cache-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'jest.config.ts') }}-${{ matrix.instance }}
restore-keys: |
jest-cache-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'jest.config.ts') }}-
jest-cache-${{ runner.os }}-

- name: Download jest-balance.json
id: download-artifact
uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11
Expand Down
1 change: 0 additions & 1 deletion .vercelignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
!src/sentry/locale/**
!build-utils
!build-utils/**
!babel.config.js
!jest.config.js
!now.json
!package.json
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ export default typescript.config([
plugins: {'@emotion': emotion},
rules: {
'@emotion/import-from-emotion': 'off', // Not needed, in v11 we import from @emotion/react
'@emotion/jsx-import': 'off', // Not needed, handled by babel
'@emotion/jsx-import': 'off', // Not needed, handled by swc
'@emotion/no-vanilla': 'error',
'@emotion/pkg-renaming': 'off', // Not needed, we have migrated to v11 and the old package names cannot be used anymore
'@emotion/styled-import': 'error',
Expand Down
64 changes: 33 additions & 31 deletions jest.config.snapshots.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,47 @@
import type {TransformOptions} from '@babel/core';
import type {Config} from '@jest/types';
import type {Options as SwcOptions} from '@swc/core';

const babelConfig: TransformOptions = {
presets: [
[
'@babel/preset-react',
{
const swcConfig: SwcOptions = {
isModule: true,
module: {
type: 'commonjs',
},
sourceMaps: 'inline',
jsc: {
target: 'esnext',
parser: {
syntax: 'typescript',
tsx: true,
dynamicImport: true,
},
transform: {
react: {
runtime: 'automatic',
importSource: '@emotion/react',
},
],
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: '3.41',
targets: {
node: 'current',
},
},
],
['@babel/preset-typescript', {allowDeclareFields: true, onlyRemoveTypeImports: true}],
],
plugins: [
[
'@emotion/babel-plugin',
{
sourceMap: false,
},
],
],
},
experimental: {
plugins: [
['@swc-contrib/mut-cjs-exports', {}],
[
'@swc/plugin-emotion',
{
sourceMap: false,
autoLabel: 'never',
},
],
],
},
},
};

/**
* ESM packages that need to be transformed by babel-jest.
* ESM packages that need to be transformed.
*/
const ESM_NODE_MODULES = ['screenfull', 'cbor2', 'nuqs', 'color'];

const config: Config.InitialOptions = {
cacheDirectory: '.cache/jest-snapshots',
// testEnvironment and testMatch are the core differences between this and the main config
testEnvironment: 'node',
testMatch: ['<rootDir>/static/**/*.snapshots.tsx'],
Expand All @@ -63,9 +67,7 @@ const config: Config.InitialOptions = {
},

transform: {
'^.+\\.jsx?$': ['babel-jest', babelConfig as any],
'^.+\\.tsx?$': ['babel-jest', babelConfig as any],
'^.+\\.mjs?$': ['babel-jest', babelConfig as any],
'^.+\\.[mc]?[jt]sx?$': ['@swc/jest', swcConfig],
},
transformIgnorePatterns: [
ESM_NODE_MODULES.length
Expand Down
53 changes: 23 additions & 30 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,32 @@ import {execFileSync} from 'node:child_process';
import path from 'node:path';
import process from 'node:process';

import type {TransformOptions} from '@babel/core';
import type {Config} from '@jest/types';
import type {Options as SwcOptions} from '@swc/core';

const babelConfig: TransformOptions = {
presets: [
[
'@babel/preset-react',
{
const swcConfig: SwcOptions = {
isModule: true,
module: {
type: 'commonjs',
},
sourceMaps: 'inline',
jsc: {
target: 'esnext',
parser: {
syntax: 'typescript',
tsx: true,
dynamicImport: true,
},
transform: {
react: {
runtime: 'automatic',
importSource: '@emotion/react',
},
],
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: '3.41',
targets: {
node: 'current',
},
},
],
// TODO: Remove allowDeclareFields when we upgrade to Babel 8
['@babel/preset-typescript', {allowDeclareFields: true, onlyRemoveTypeImports: true}],
],
plugins: [
[
'@emotion/babel-plugin',
{
sourceMap: false,
},
],
],
},
experimental: {
plugins: [['@swc-contrib/mut-cjs-exports', {}]],
},
},
};

const {
Expand Down Expand Up @@ -284,6 +277,7 @@ const ESM_NODE_MODULES = [

const config: Config.InitialOptions = {
verbose: false,
cacheDirectory: '.cache/jest',
collectCoverageFrom: [
'static/app/**/*.{js,jsx,ts,tsx}',
'!static/app/**/*.spec.{js,jsx,ts,tsx}',
Expand Down Expand Up @@ -334,8 +328,7 @@ const config: Config.InitialOptions = {
'<rootDir>/node_modules/reflux',
],
transform: {
'^.+\\.jsx?$': ['babel-jest', babelConfig as any],
'^.+\\.tsx?$': ['babel-jest', babelConfig as any],
'^.+\\.[mc]?[jt]sx?$': ['@swc/jest', swcConfig],
'^.+\\.pegjs?$': '<rootDir>/tests/js/jest-pegjs-transform.js',
},
transformIgnorePatterns: [
Expand Down
5 changes: 1 addition & 4 deletions knip.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,8 @@ const config: KnipConfig = {
'tslib', // subdependency of many packages, declare the latest version
'buffer', // rspack.ProvidePlugin, needs better knip plugin
'process', // rspack.ProvidePlugin, needs better knip plugin
'@babel/preset-env', // Still used in jest
'@babel/preset-react', // Still used in jest
'@babel/preset-typescript', // Still used in jest
'@emotion/babel-plugin', // Still used in jest
'odiff-bin', // raw binary consumed by Python backend, not a JS import
'@swc-contrib/mut-cjs-exports', // used in jest config
],
rules: {
binaries: 'off',
Expand Down
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,10 @@
},
"dependencies": {
"@amplitude/analytics-browser": "^1.5.3",
"@babel/core": "~7.29.0",
"@babel/preset-env": "~7.29.0",
"@babel/preset-react": "^7.28.5",
"@babel/preset-typescript": "^7.28.5",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/modifiers": "7.0.0",
"@dnd-kit/sortable": "^8.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@emotion/babel-plugin": "^11.13.5",
"@emotion/cache": "^11.14.0",
"@emotion/css": "^11.13.5",
"@emotion/is-prop-valid": "^1.3.0",
Expand Down Expand Up @@ -122,7 +117,7 @@
"@sentry/webpack-plugin": "4.6.1",
"@stripe/react-stripe-js": "^3.9.2",
"@stripe/stripe-js": "^5.10.0",
"@swc/plugin-emotion": "14.3.0",
"@swc/plugin-emotion": "14.8.0",
"@tanstack/query-async-storage-persister": "5.96.0",
"@tanstack/react-devtools": "0.9.9",
"@tanstack/react-form": "1.28.6",
Expand Down Expand Up @@ -242,6 +237,9 @@
"@sentry/jest-environment": "6.1.0",
"@sentry/profiling-node": "10.41.0-beta.0",
"@styled/typescript-styled-plugin": "^1.0.1",
"@swc-contrib/mut-cjs-exports": "14.8.0",
"@swc/core": "1.15.24",
"@swc/jest": "0.2.39",
"@tanstack/eslint-plugin-query": "5.96.0",
"@testing-library/dom": "10.4.1",
"@testing-library/jest-dom": "6.9.1",
Expand All @@ -255,7 +253,6 @@
"@typescript-eslint/utils": "8.58.0",
"@typescript/native-preview": "7.0.0-dev.20260401.1",
"@volar/typescript": "^2.4.28",
"babel-jest": "30.3.0",
"eslint": "9.34.0",
"eslint-config-prettier": "10.1.8",
"eslint-import-resolver-typescript": "^3.8.3",
Expand Down
Loading
Loading