Commit e2d65a1
test(core): Resolve @sentry/* to CJS builds in Jest (#6301)
As of JS SDK v10.58.0 the @sentry/* packages expose a `react-native`
export condition pointing at their ESM build. The `react-native` Jest
preset's test environment sets `customExportConditions = ['require',
'react-native']`, so Jest resolves that condition and loads untransformed
ESM (including transitive subpaths like `@sentry/core/browser`), failing
with "Unexpected token 'export'".
Use a custom test environment that drops the `react-native` condition so
these packages resolve to their CJS builds, as they did before 10.58.0.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent b18a991 commit e2d65a1
2 files changed
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments