Title: LOCALE_ID accessed in tests before APP_INITIALIZER runs (with Ivy) · Issue #36230 · angular/angular · GitHub
Open Graph Title: LOCALE_ID accessed in tests before APP_INITIALIZER runs (with Ivy) · Issue #36230 · angular/angular
X Title: LOCALE_ID accessed in tests before APP_INITIALIZER runs (with Ivy) · Issue #36230 · angular/angular
Description: 🐞 bug report Affected Package The issue is caused by package @angular/core. Is this a regression? Yes, the previous version in which this bug was not present was: ^8.2.0 (not using Ivy) This also works if @angular/core is not processed b...
Open Graph Description: 🐞 bug report Affected Package The issue is caused by package @angular/core. Is this a regression? Yes, the previous version in which this bug was not present was: ^8.2.0 (not using Ivy) This also w...
X Description: 🐞 bug report Affected Package The issue is caused by package @angular/core. Is this a regression? Yes, the previous version in which this bug was not present was: ^8.2.0 (not using Ivy) This also w...
Opengraph URL: https://github.com/angular/angular/issues/36230
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"LOCALE_ID accessed in tests before APP_INITIALIZER runs (with Ivy)","articleBody":"\u003c!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅\r\n\r\nOh hi there! 😄\r\n\r\nTo expedite issue processing please search open and closed issues before submitting a new one.\r\nExisting issues often contain information about workarounds, resolution, or progress updates.\r\n\r\n🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->\r\n\r\n\r\n# 🐞 bug report\r\n\r\n### Affected Package\r\n\u003c!-- Can you pin-point one or more @angular/* packages as the source of the bug? -->\r\nThe issue is caused by package @angular/core.\r\n\r\n\r\n### Is this a regression?\r\n\r\n\u003c!-- Did this behavior use to work in the previous version? -->\r\nYes, the previous version in which this bug was not present was: ^8.2.0 (not using Ivy)\r\n\r\nThis also works if @angular/core is not processed by `ngcc` (when the tests use ViewEngine instead of Ivy) - we use jest, which does not call `ngcc` automatically like the default Angular CLI setup with karma, so we can test both scenarios easily in our private project repository.\r\n\r\n\r\n### Description\r\nThere was a pull request (#34830) that ensured all `APP_INITIALIZER` functions are executed before `LOCALE_ID` is first accessed. This works correctly when the application is served (whether the initializer is synchronous or asynchronous).\r\n\r\nBut when running tests, this is not happening. The `LOCALE_ID` is accessed before `APP_INITIALIZER` functions are executed, thus ending in the locale being undefined.\r\n\r\n\r\n## 🔬 Minimal Reproduction\r\nhttps://github.com/IgorAufricht/angular-locale-id-test-repro\r\n\r\nThe steps are included in the readme, but for clarity, here they are:\r\n* `git clone https://github.com/IgorAufricht/angular-locale-id-test-repro`\r\n* `npm install`\r\n* `ng serve` (application loads correctly, console confirms that `LOCALE_ID = fr-FR`)\r\n* `ng test` (fails, `Error: Expected '' to equal 'fr-FR'`)\r\n\r\n**Angular Version:**\r\n\u003cpre>\u003ccode>\r\nAngular CLI: 9.0.7\r\nNode: 12.13.1\r\nOS: win32 x64\r\n\r\nAngular: 9.0.7\r\n... animations, cli, common, compiler, compiler-cli, core, forms\r\n... language-service, platform-browser, platform-browser-dynamic\r\n... router\r\nIvy Workspace: Yes\r\n\r\nPackage Version\r\n-----------------------------------------------------------\r\n@angular-devkit/architect 0.900.7\r\n@angular-devkit/build-angular 0.900.7\r\n@angular-devkit/build-optimizer 0.900.7\r\n@angular-devkit/build-webpack 0.900.7\r\n@angular-devkit/core 9.0.7\r\n@angular-devkit/schematics 9.0.7\r\n@ngtools/webpack 9.0.7\r\n@schematics/angular 9.0.7\r\n@schematics/update 0.900.7\r\nrxjs 6.5.4\r\ntypescript 3.7.5\r\nwebpack 4.41.2\r\n\u003c/code>\u003c/pre>\r\n\r\n**Anything else relevant?**\r\nRelated to #34830.","author":{"url":"https://github.com/IgorAufricht","@type":"Person","name":"IgorAufricht"},"datePublished":"2020-03-24T15:41:28Z","url":"https://github.com/angular/angular/issues/36230"}
| 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:5cd0d28a-b094-cdc4-21fb-497ec37db661 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E5D6:3A347:13E770D:1A5FE02:6B0123BB |
| html-safe-nonce | 59ae0154e1e2f2b10eb1a8864e091a87c0893cc8db4640bc5197f5c98885987e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNUQ2OjNBMzQ3OjEzRTc3MEQ6MUE1RkUwMjo2QjAxMjNCQiIsInZpc2l0b3JfaWQiOiI0MDU5ODM1MjMyOTU2Nzg1NTk1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1502169ae26daa9f60890916a56f6dc60a5a50c790c299e0a62d6e218b88be5b |
| hovercard-subject-tag | issue:587056894 |
| 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/36230/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7d45e9054e5e4ef5b6f5a1c593201c91d2428f5cfbd6eb4d5b67ab49ebad9ecb/angular/angular/issues/36230 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7d45e9054e5e4ef5b6f5a1c593201c91d2428f5cfbd6eb4d5b67ab49ebad9ecb/angular/angular/issues/36230 |
| og:image:alt | 🐞 bug report Affected Package The issue is caused by package @angular/core. Is this a regression? Yes, the previous version in which this bug was not present was: ^8.2.0 (not using Ivy) This also w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | IgorAufricht |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width