mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
6bf8b1007c
Previously, [this test][1] would occasionally fail (e.g. on CI) with "Template cache was not found in $templateCache". This was due to a combination of: 1. [That test][2] (which removes the cache) being run right before the failing test. 2. The async `TestBed.compileComponents()` operation run in the `beforeEach()` block (which sets the cache) not having completed before the `it()` block. This commit fixes the issue by ensuring the cache is always set, before instantiating `CachedResourceLoader`. This commit also moves some operations that are only needed in one test from the `beforeEach()` block to that test's `it()` block. [1]: https://github.com/angular/angular/blob/79903b184248a57d7e9e10d69c94098f4fe34fa6/packages/platform-browser-dynamic/test/resource_loader/resource_loader_cache_spec.ts#L50 [2]: https://github.com/angular/angular/blob/79903b184248a57d7e9e10d69c94098f4fe34fa6/packages/platform-browser-dynamic/test/resource_loader/resource_loader_cache_spec.ts#L37 Fixes #30499 PR Close #30515