You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Jest fails with "Unexpected token 'export'" in @sentry/core since the react-native export condition (JS SDK 10.58.0) #6953
(Not relevant to the issue: it fails at import time, before Sentry.init() runs.)
Steps to Reproduce
Expo project with "jest": { "preset": "jest-expo" } (same with @react-native/jest-preset).
A module imports the SDK, e.g. import { captureException } from "@sentry/react-native";
A test imports that module withoutjest.mock("@sentry/react-native").
Run npx jest.
Works on @sentry/react-native 7.11.0 (@sentry/core 10.37.0). Fails after upgrading to 8.32.0 (@sentry/core 10.76.2).
Expected Result
The test suite runs. Importing @sentry/react-native in a Jest test should not require extra Jest configuration, or the required configuration should be documented.
The React Native Jest environment sets customExportConditions = ['require', 'react-native'], so Jest now resolves @sentry/core, @sentry/react, @sentry/browser, @sentry/browser-utils, @sentry/feedback, @sentry/replay and @sentry/replay-canvas to ESM.
jest-expo / @react-native/jest-preset only allow @sentry/react-native through Babel, so the ESM is loaded untransformed.
This repo hit the same failure and fixed its own test suite in test(core): Resolve @sentry/* to CJS builds in Jest #6301 (custom test environment that drops the react-native condition). That PR calls it "not a user-facing issue", but any app test that imports the SDK without mocking it fails the same way. Nothing in the docs or the 8.x changelog mentions it.
Activity
linear-code commentedon Oct 27, 2026
RN-838
antonis commentedon Oct 27, 2026
Thank you for reporting @Yummy-sk 🙇 We will check this and iterate back.
docs(react-native): Add Jest "Unexpected token 'export'" troubleshoot…
antonis commentedon Oct 27, 2026
thanks again for reporting. We've updated the documentation with getsentry/sentry-docs#20251