Title: `TestBed.overrideProviders` does not override providers of imported standalone directives · Issue #56528 · angular/angular · GitHub
Open Graph Title: `TestBed.overrideProviders` does not override providers of imported standalone directives · Issue #56528 · angular/angular
X Title: `TestBed.overrideProviders` does not override providers of imported standalone directives · Issue #56528 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description If a directive is standalone, and provides something, if it's included only (non-transitively) in the imports array of configureTestingModul...
Open Graph Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description If a directive is standalone, and provides something, if it's included only (non-transitively) in th...
X Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description If a directive is standalone, and provides something, if it's included only (non-transitively) i...
Opengraph URL: https://github.com/angular/angular/issues/56528
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`TestBed.overrideProviders` does not override providers of imported standalone directives","articleBody":"### Which @angular/* package(s) are the source of the bug?\r\n\r\ncore\r\n\r\n### Is this a regression?\r\n\r\nNo\r\n\r\n### Description\r\n\r\nIf a directive is standalone, and provides something, if it's included _only_ (non-transitively) in the `imports` array of `configureTestingModule`, then `TestBed.overrideProviders` will not override the providers for that directive.\r\n\r\n### Please provide a link to a minimal reproduction of the bug\r\n\r\nhttps://stackblitz.com/edit/stackblitz-starters-avb6ge?file=src%2Fdirective%2Fdirective.spec.ts\r\n\r\n### Please provide the exception or error you saw\r\n\r\n```true\r\nyarn run v1.22.19\r\n$ jest\r\n FAIL src/directive/directive.spec.ts (8.55 s)\r\n AppComponent\r\n ✕ should have the right overridden token (56 ms)\r\n\r\n ● AppComponent › should have the right overridden token\r\n\r\n Expected value undefined\r\n Received:\r\n undefined\r\n \r\n Message:\r\n expect(received).toBe(expected) // Object.is equality\r\n \r\n Expected: \"overridden\"\r\n Received: \"not overridden\"\r\n\r\n Difference:\r\n\r\n Compared values have no visual difference.Error:\r\n\r\n 33 |\r\n 34 | it('should have the right overridden token', () =\u003e {\r\n \u003e 35 | expect(directive.service.value).toBe('overridden');\r\n | ^\r\n 36 | });\r\n 37 | });\r\n 38 |\r\n\r\n at eval (src/directive/directive.spec.ts:35:37)\r\n at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:412:32)\r\n at ProxyZoneSpec.Object.\u003canonymous\u003e.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing.umd.js:2164:43)\r\n at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:411:38)\r\n at ZoneImpl.run (node_modules/zone.js/bundles/zone.umd.js:147:47)\r\n at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing.umd.js:450:38)\r\n\r\nTest Suites: 1 failed, 1 total\r\nTests: 1 failed, 1 total\r\nSnapshots: 0 total\r\nTime: 9.119 s\r\nRan all test suites.\r\n✨ Done in 11.16s.\r\n```\r\n\r\n\r\n### Please provide the environment you discovered this bug in (run `ng version`)\r\n\r\n```true\r\nAngular CLI: 18.0.4\r\nNode: 18.20.3\r\nPackage Manager: yarn 1.22.19\r\nOS: linux x64\r\n\r\nAngular: 18.0.3\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... platform-browser, platform-browser-dynamic, router\r\n\r\nPackage Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect 0.1800.4\r\n@angular-devkit/build-angular 18.0.4\r\n@angular-devkit/core 18.0.4\r\n@angular-devkit/schematics 18.0.4\r\n@angular/cli 18.0.4\r\n@schematics/angular 18.0.4\r\nrxjs 7.8.1\r\ntypescript 5.4.5\r\nzone.js 0.14.7\r\n```\r\n\r\n\r\n### Anything else?\r\n\r\n_No response_","author":{"url":"https://github.com/BobobUnicorn","@type":"Person","name":"BobobUnicorn"},"datePublished":"2024-06-20T17:13:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/56528/angular/issues/56528"}
| 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:89cdcd2b-aefa-0159-6cc8-3a6b4feaedd3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8FE4:11B87F:4A43630:6193187:6974ABEF |
| html-safe-nonce | 0dae4f54be87603172a29d05e812ac23a89986deab6b29187316fcd520d5138a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RkU0OjExQjg3Rjo0QTQzNjMwOjYxOTMxODc6Njk3NEFCRUYiLCJ2aXNpdG9yX2lkIjoiODU3ODg3NTU3Njk2ODA2Mzk4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ec591df3ed39710c68c0b50ebcef75bf9439397614f067d39b896a425cec24fc |
| hovercard-subject-tag | issue:2364903013 |
| 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/56528/issue_layout |
| twitter:image | https://opengraph.githubassets.com/211642d1897b821e0d15adf36b71b9b3f1408db4e405495af6249c93af999c8f/angular/angular/issues/56528 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/211642d1897b821e0d15adf36b71b9b3f1408db4e405495af6249c93af999c8f/angular/angular/issues/56528 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description If a directive is standalone, and provides something, if it's included only (non-transitively) in th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | BobobUnicorn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f |
| 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 | 488b30e96dfd057fbbe44c6665ccbc030b729dde |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width