Title: Cannot find `@sentry/angular-ivy` module in Jest tests when using Angular 17.x · Issue #9628 · getsentry/sentry-javascript · GitHub
Open Graph Title: Cannot find `@sentry/angular-ivy` module in Jest tests when using Angular 17.x · Issue #9628 · getsentry/sentry-javascript
X Title: Cannot find `@sentry/angular-ivy` module in Jest tests when using Angular 17.x · Issue #9628 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/9628
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot find `@sentry/angular-ivy` module in Jest tests when using Angular 17.x","articleBody":"### Is there an existing issue for this?\r\n\r\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\r\n- [X] I have reviewed the documentation https://docs.sentry.io/\r\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\r\n\r\n### How do you use Sentry?\r\n\r\nSentry Saas (sentry.io)\r\n\r\n### Which SDK are you using?\r\n\r\n@sentry/angular-ivy\r\n\r\n### SDK Version\r\n\r\n7.81.1\r\n\r\n### Framework Version\r\n\r\n17.0.4\r\n\r\n### Link to Sentry event\r\n\r\n_No response_\r\n\r\n### SDK Setup\r\n\r\n_No response_\r\n\r\n### Steps to Reproduce\r\n\r\n1. I have updated our project to the latest Angular 17.x version\r\n2. I have updated Sentry to the latest version that requires Angular\r\n3. I have tried to run the tests and I received a module not found error. \r\n\r\nWe are using [`@angular-builders/jest`](https://github.com/just-jeb/angular-builders) to run our tests via Jest (the problem surfaces with default configuration). \r\n\r\nSteps to reproduce:\r\n- generate a new Angular project\r\n- configure `@angular-builders/jest` following readme\r\n- import sentry in the app component\r\n- create a test that imports the app component\r\n- run the test and observe that Jest fails with a module not found import error\r\n\r\n### Expected Result\r\n\r\nJest tests continue to work without a problem.\r\n\r\n### Actual Result\r\n\r\nEvery test fails that references a file that imports Sentry in any way with the following message:\r\n```\r\nCannot find module '@sentry/angular-ivy' from '\u003cmy-app>/path-to-file-where-sentry-is-imported.ts'\r\n```\r\n\r\nI think the root cause of this problem is the same as reported in this issue:\r\n- https://github.com/getsentry/sentry-javascript/issues/9448\r\n\r\nTests will start to work again when I revert back the [referenced change](https://github.com/getsentry/sentry-javascript/pull/9412) by adding the `main` entry point in the `node_modules` folder:\r\n```\r\n\"main\": \"bundles/sentry-angular-ivy.umd.js\",\r\n```\r\n\r\n\r\n\r\nThere is a workaround. The following snippet should be added to the Jest config:\r\n```js\r\n moduleNameMapper: {\r\n '@sentry/angular-ivy': '\u003crootDir>/node_modules/@sentry/angular-ivy/bundles/sentry-angular-ivy.umd.js',\r\n },\r\n``` \r\n\r\nThis mandatory workaround should be possibly documented somewhere prominent.","author":{"url":"https://github.com/NoNameProvided","@type":"Person","name":"NoNameProvided"},"datePublished":"2023-11-21T19:17:39Z","url":"https://github.com/getsentry/sentry-javascript/issues/9628"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:96f5a3b7-74ea-7507-89cf-b818aabdf117 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E922:298A98:2204033:2C50A23:6B0414A6 |
| html-safe-nonce | 30eb2abbaca488d55cfeaa5824cc1c9a3634ad46b2e594fb84ed9f9da6e6ddb9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTIyOjI5OEE5ODoyMjA0MDMzOjJDNTBBMjM6NkIwNDE0QTYiLCJ2aXNpdG9yX2lkIjoiNzg2NDg4OTI2NzQ5ODI1OTYyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6702d104fd274d9bdbc87ddbdc2781a7aa03646f10505ae05b09fb45eb7ce44d |
| hovercard-subject-tag | issue:2004975804 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/9628/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d225aa05143834602f22335046160cd7ff4aa99ae60ab2f7a27bd0525769ccd6/getsentry/sentry-javascript/issues/9628 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d225aa05143834602f22335046160cd7ff4aa99ae60ab2f7a27bd0525769ccd6/getsentry/sentry-javascript/issues/9628 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NoNameProvided |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width