Title: Unit test fails with zone application and vitest · Issue #32555 · angular/angular-cli · GitHub
Open Graph Title: Unit test fails with zone application and vitest · Issue #32555 · angular/angular-cli
X Title: Unit test fails with zone application and vitest · Issue #32555 · angular/angular-cli
Description: Command test Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description Hello Angular Team, ng version: 21.1.5 Unit tests fail in a ver...
Open Graph Description: Command test Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description Hello Angular Team, ng ...
X Description: Command test Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description Hello Angular Team, ng ...
Opengraph URL: https://github.com/angular/angular-cli/issues/32555
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unit test fails with zone application and vitest","articleBody":"### Command\n\ntest\n\n### Is this a regression?\n\n- [ ] Yes, this behavior used to work in the previous version\n\n### The previous version in which this bug was not present was\n\n_No response_\n\n### Description\n\nHello Angular Team,\n\nng version: 21.1.5\n\nUnit tests fail in a very weird way for projects that use the zone\nSome fields of the components are simply not assigned, which causes a failure when the view is rendered\nStrangely, this happens when multiples components consumes the same import ( this typically happens with exported constants )\n\nYou can find a simple repro below. \n\nhttps://stackblitz.com/edit/angular-v21-starter-w7aywxrw?file=README.md\n\nIf I remove the polyfill, it passes ( I've noticed that the generated javascript is different )\n\nPlease not that we cannot migrate all our apps/libs to zoneless in one shot ( we are in an enterprise setup with a lot of libs ),\nso it's really an issue that prevent us for migrating to ng21\n\nThanks for considering this issue,\n\nFC\n\n### Minimal Reproduction\n\nhttps://stackblitz.com/edit/angular-v21-starter-w7aywxrw?file=README.md\n\n\n### Exception or Error\n\n```text\nSome fields of the component is undefined, which causes failure when the template is rendered during the test.\n\n\n\nTypeError: Cannot read properties of undefined (reading 'A')\n```\n\n### Your Environment\n\n```text\n_ _ ____ _ ___\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\n / △ \\ | '_ \\ / _` | | | | |/ _` | '__| | | | | | |\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\n /_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\n |___/\n \n\nAngular CLI : 21.1.5\nAngular : 21.1.5\nNode.js : 20.19.1\nPackage Manager : npm 10.8.2\nOperating System : linux x64\n\n┌───────────────────────────┬───────────────────┬───────────────────┐\n│ Package │ Installed Version │ Requested Version │\n├───────────────────────────┼───────────────────┼───────────────────┤\n│ @angular/build │ 21.1.5 │ ^21.1.5 │\n│ @angular/cli │ 21.1.5 │ ^21.1.5 │\n│ @angular/common │ 21.1.5 │ ^21.1.5 │\n│ @angular/compiler │ 21.1.5 │ ^21.1.5 │\n│ @angular/compiler-cli │ 21.1.5 │ ^21.1.5 │\n│ @angular/core │ 21.1.5 │ ^21.1.5 │\n│ @angular/forms │ 21.1.5 │ ^21.1.5 │\n│ @angular/platform-browser │ 21.1.5 │ ^21.1.5 │\n│ @angular/router │ 21.1.5 │ ^21.1.5 │\n│ rxjs │ 7.8.2 │ ~7.8.0 │\n│ typescript │ 5.9.3 │ ~5.9.2 │\n│ vitest │ 4.0.18 │ ^4.0.8 │\n│ zone.js │ 0.15.1 │ ~0.15.0 │\n└───────────────────────────┴───────────────────┴──────────────────\n```\n\n### Anything else relevant?\n\nRemoving the polyfill fixes it.\n\nTweaking the tsconfig.spec.json to use node module system fixes it ( see in the stackblitz )","author":{"url":"https://github.com/chabb","@type":"Person","name":"chabb"},"datePublished":"2026-02-24T09:44:24Z","url":"https://github.com/angular/angular-cli/issues/32555"}
| 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:c6bbac96-f6da-dfd2-8378-27b3f7f257b3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 86A4:215B92:30FC33F:41448DC:6B01E970 |
| html-safe-nonce | eecddd6593b654f9f3595b7cf33850d9dfd6d654e47cbe036ea91bfe873ca10b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NkE0OjIxNUI5MjozMEZDMzNGOjQxNDQ4REM6NkIwMUU5NzAiLCJ2aXNpdG9yX2lkIjoiODYyMTk1NTI4ODY3ODkxODUxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7e31e922b9f514fad0a6dc041c980204b5af0dba009e231ba26157a4467490f7 |
| hovercard-subject-tag | issue:3982599295 |
| 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/angular/angular-cli/32555/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2b5a4476a514c91881a11a26f4bed95597204c8e41a12d72e1b890aec4250955/angular/angular-cli/issues/32555 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2b5a4476a514c91881a11a26f4bed95597204c8e41a12d72e1b890aec4250955/angular/angular-cli/issues/32555 |
| og:image:alt | Command test Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description Hello Angular Team, ng ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | chabb |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| 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:
Viewport: width=device-width