René's URL Explorer Experiment


Title: Recent change in compiler-cli breaks jest-preset-angular · Issue #48448 · angular/angular · GitHub

Open Graph Title: Recent change in compiler-cli breaks jest-preset-angular · Issue #48448 · angular/angular

X Title: Recent change in compiler-cli breaks jest-preset-angular · Issue #48448 · angular/angular

Description: Which @angular/* package(s) are the source of the bug? compiler-cli Is this a regression? Yes Description I'm currently investigating an error that occurs in certain situations when running tests with jest-preset-angular and typescript 4...

Open Graph Description: Which @angular/* package(s) are the source of the bug? compiler-cli Is this a regression? Yes Description I'm currently investigating an error that occurs in certain situations when running tests w...

X Description: Which @angular/* package(s) are the source of the bug? compiler-cli Is this a regression? Yes Description I'm currently investigating an error that occurs in certain situations when running tes...

Opengraph URL: https://github.com/angular/angular/issues/48448

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Recent change in compiler-cli breaks jest-preset-angular ","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\ncompiler-cli\n\n### Is this a regression?\n\nYes\n\n### Description\n\nI'm currently investigating an error that occurs in certain situations when running tests with jest-preset-angular and typescript 4.8. There are several issue reports over at jest-preset-angular, nrwl/nx and possibly others.\r\n\r\n### Error description\r\n\r\nIn short, this code will break jest / jest-preset-angular, throwing `ReferenceError: anywhere_1 is not defined`, when running typescript 4.8.\r\n\r\n```ts\r\nimport {InterfaceFromInterfaceOnlyModule } from './anywhere' ;\r\nclass X {\r\n\t@MyDecorator() test():InterfaceFromInterfaceOnlyModule { ... }\r\n}\r\n```\r\n\r\nA reproduction is available at https://github.com/jbjhjm/jest28-bug .\r\n\r\nThe error occurs when following circumstances are given:\r\n\r\n- use angular with typescript 4.8 (so ng 15) and jest with jest-preset-angular\r\n- Import nothing but an interface or type from a module\r\n- Use it on a method that is being decorated\r\n- Have emitDecoratorMetadata enabled\r\n\r\nIt seems like response type of a decorated method somehow \"bleeds\" into compiled javascript, where it causes an error because the type-only module does not exist anymore, ending up in a ReferenceError.\r\n\r\n### Origin of error\r\n\r\njest-preset-angular uses the downlevel_decorators_transform.ts from compiler-cli.\r\nWe managed to hunt the error down to a recent change in there.\r\n\r\nhttps://github.com/angular/angular/pull/47167 modified that file in L565, replacing updateClassDeclaration by  createClassDeclaration. \r\n\r\nHere https://github.com/thymikee/jest-preset-angular/issues/1199#issuecomment-1345445251 , @n9niwas has shown a patch reverting that change to make it work as desired again, stating: \"Idk for sure, but suspect that calling create* methods instead of update* makes TS program to forget information about whether a particular import is type-only or not.\"\r\n\r\n@crisbeto , your insights might help here a lot.\r\nI am not sure if downlevel_decorators_transform currently generates unexpected code, or if jest-preset-angular needs to update its own implementation to work correctly with the new code.\r\nWhat's your estimation? Can you explain why `createClassDeclaration` is used now?\r\n\r\n---\r\n\r\nRelated issues:\r\n\r\nhttps://github.com/thymikee/jest-preset-angular/issues/1199\r\nhttps://github.com/thymikee/jest-preset-angular/issues/1810\r\nhttps://github.com/nrwl/nx/issues/10660\n\n### Please provide a link to a minimal reproduction of the bug\n\nhttps://github.com/jbjhjm/jest28-bug\n\n### Please provide the exception or error you saw\n\n```true\njest will throw `ReferenceError: xxx is not defined`\n```\n\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nAngular CLI: 15.0.2\r\nNode: 16.17.0\r\nPackage Manager: npm 8.15.0\r\nOS: win32 x64\r\n\r\nAngular: 15.0.2\r\n... animations, cli, common, compiler, compiler-cli, core, forms\r\n... language-service, platform-browser, platform-browser-dynamic\r\n... router\r\n\r\nPackage                         Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect       0.1500.2\r\n@angular-devkit/build-angular   15.0.2\r\n@angular-devkit/core            15.0.2\r\n@angular-devkit/schematics      15.0.2\r\n@schematics/angular             15.0.2\r\nrxjs                            7.5.7\r\ntypescript                      4.8.4\n```\n\n\n### Anything else?\n\n_No response_","author":{"url":"https://github.com/jbjhjm","@type":"Person","name":"jbjhjm"},"datePublished":"2022-12-12T11:13:53Z","url":"https://github.com/angular/angular/issues/48448"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3c1b000a-71e3-9ea3-706f-83782616241e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA184:2564F:92B5A5:C3AE92:6B00E253
html-safe-nonce431f2efd2d18d7987b5c5675886b958f96b61f928ec364c2af622fc57e4112d6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTg0OjI1NjRGOjkyQjVBNTpDM0FFOTI6NkIwMEUyNTMiLCJ2aXNpdG9yX2lkIjoiNzkzNDQ2OTI3MDk5NjU3NDgwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca5d46b1f37b8482502e1b0b48a5bdd001f2fe34406d65d01db8e1c34560e06ca
hovercard-subject-tagissue:1491611161
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/48448/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1fca49cfbcf26069a6d6a4420061cfc710dc4568043eab22e5ddc1542cdee89a/angular/angular/issues/48448
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1fca49cfbcf26069a6d6a4420061cfc710dc4568043eab22e5ddc1542cdee89a/angular/angular/issues/48448
og:image:altWhich @angular/* package(s) are the source of the bug? compiler-cli Is this a regression? Yes Description I'm currently investigating an error that occurs in certain situations when running tests w...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejbjhjm
hostnamegithub.com
expected-hostnamegithub.com
None27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release624179fb8b88d26ba5bba08894eb60a1c5a1d93d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/48448#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F48448
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F48448
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/48448
Reloadhttps://github.com/angular/angular/issues/48448
Reloadhttps://github.com/angular/angular/issues/48448
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)https://github.com/angular/angular/issues
Pull requests140 (140)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/48448
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/48448
Recent change in compiler-cli breaks jest-preset-angular https://github.com/angular/angular/issues/48448#top
https://github.com/crisbeto
P2The issue is important to a large percentage of users, with a workaroundhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P2%22
area: compilerIssues related to `ngc`, Angular's template compilerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20compiler%22
bughttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22bug%22
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
Backloghttps://github.com/angular/angular/milestone/82
https://github.com/jbjhjm
jbjhjmhttps://github.com/jbjhjm
on Dec 12, 2022https://github.com/angular/angular/issues/48448#issue-1491611161
https://github.com/jbjhjm/jest28-bughttps://github.com/jbjhjm/jest28-bug
#47167https://github.com/angular/angular/pull/47167
thymikee/jest-preset-angular#1199 (comment)https://github.com/thymikee/jest-preset-angular/issues/1199#issuecomment-1345445251
@n9niwashttps://github.com/n9niwas
@crisbetohttps://github.com/crisbeto
thymikee/jest-preset-angular#1199https://github.com/thymikee/jest-preset-angular/issues/1199
thymikee/jest-preset-angular#1810https://github.com/thymikee/jest-preset-angular/issues/1810
nrwl/nx#10660https://github.com/nrwl/nx/issues/10660
https://github.com/jbjhjm/jest28-bughttps://github.com/jbjhjm/jest28-bug
jessicajaniukhttps://github.com/jessicajaniuk
area: compilerIssues related to `ngc`, Angular's template compilerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20compiler%22
on Dec 12, 2022https://github.com/angular/angular/issues/48448#event-8016705834
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on Dec 12, 2022https://github.com/angular/angular/issues/48448#event-8016705991
crisbetohttps://github.com/crisbeto
needsTriagehttps://github.com/angular/angular/milestone/83
Backloghttps://github.com/angular/angular/milestone/82
on Dec 14, 2022https://github.com/angular/angular/issues/48448#event-8038827788
ngbothttps://github.com/apps/ngbot
Backloghttps://github.com/angular/angular/milestone/82
needsTriagehttps://github.com/angular/angular/milestone/83
on Dec 14, 2022https://github.com/angular/angular/issues/48448#event-8038828344
crisbetohttps://github.com/crisbeto
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
bughttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22bug%22
on Dec 14, 2022https://github.com/angular/angular/issues/48448#event-8038830499
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
Backloghttps://github.com/angular/angular/milestone/82
on Dec 14, 2022https://github.com/angular/angular/issues/48448#event-8038830733
crisbetohttps://github.com/crisbeto
state: needs more investigationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20needs%20more%20investigation%22
on Dec 14, 2022https://github.com/angular/angular/issues/48448#event-8038833438
https://github.com/crisbeto
crisbetohttps://github.com/crisbeto
on Dec 14, 2022https://github.com/angular/angular/issues/48448#issuecomment-1351698940
https://github.com/jbjhjm
jbjhjmhttps://github.com/jbjhjm
on Dec 15, 2022https://github.com/angular/angular/issues/48448#issuecomment-1352891141
@crisbetohttps://github.com/crisbeto
https://github.com/crisbeto
crisbetohttps://github.com/crisbeto
on Dec 15, 2022https://github.com/angular/angular/issues/48448#issuecomment-1353400083
https://github.com/jbjhjm
jbjhjmhttps://github.com/jbjhjm
on Dec 15, 2022https://github.com/angular/angular/issues/48448#issuecomment-1353460400
https://github.com/ctacquet
ctacquethttps://github.com/ctacquet
on Dec 27, 2022https://github.com/angular/angular/issues/48448#issuecomment-1365791884
alxhubhttps://github.com/alxhub
P2The issue is important to a large percentage of users, with a workaroundhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P2%22
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
on Dec 28, 2022https://github.com/angular/angular/issues/48448#event-8123025135
alxhubhttps://github.com/alxhub
crisbetohttps://github.com/crisbeto
on Dec 28, 2022https://github.com/angular/angular/issues/48448#event-8123025471
crisbetohttps://github.com/crisbeto
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
state: needs more investigationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20needs%20more%20investigation%22
on Jan 4, 2023https://github.com/angular/angular/issues/48448#event-8149022213
alxhubhttps://github.com/alxhub
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
33f35b0https://github.com/angular/angular/commit/33f35b04ef0f32f25624a6be59f8635675e3e131
on Jan 4, 2023https://github.com/angular/angular/issues/48448#event-8154345584
https://github.com/jbjhjm
jbjhjmhttps://github.com/jbjhjm
on Jan 5, 2023https://github.com/angular/angular/issues/48448#issuecomment-1371975594
@crisbetohttps://github.com/crisbeto
trekladyonehttps://github.com/trekladyone
on Feb 1, 2023https://github.com/angular/angular/issues/48448#event-8415363357
fix(compiler): type-only symbols incorrectly retained when downlevell…https://github.com/trekladyone/angular/commit/eb35bb3ce2ba15869da17e6572d0e6913524f84a
https://docs.github.com/articles/closing-issues-via-commit-messages
eb35bb3https://github.com/trekladyone/angular/commit/eb35bb3ce2ba15869da17e6572d0e6913524f84a
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Feb 5, 2023https://github.com/angular/angular/issues/48448#issuecomment-1418090418
automatic conversation locking policyhttps://github.com/angular/angular/blob/8f24bc9443b3872fe095d9f7f77b308a361a13b4/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Feb 5, 2023https://github.com/angular/angular/issues/48448#event-8440628127
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/48448
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/48448
crisbetohttps://github.com/crisbeto
P2The issue is important to a large percentage of users, with a workaroundhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P2%22
area: compilerIssues related to `ngc`, Angular's template compilerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20compiler%22
bughttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22bug%22
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
BacklogNo due datehttps://github.com/angular/angular/milestone/82
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.