mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
The migration was breaking tests with test modules that imported `HttpClientTestingModule`,
as it removed the JS imports without migrating the module imports.
The migration now handles the case where `HttpClientTestingModule` is used in test modules,
by replacing the module import with the `provideHttpClient` and `provideHttpClientTesting` providers.
Before:
```ts
import { HttpClientTestingModule } from '@angular/common/http/testing';
@NgModule({
declarations: [AppComponent],
imports: [HttpClientTestingModule],
})
export class TestModule {}
```
After:
```ts
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
@NgModule({
declarations: [AppComponent],
imports: [],
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
})
export class TestModule {}
```
PR Close #55803
|
||
|---|---|---|
| .. | ||
| google3 | ||
| all-migrations.spec.ts | ||
| BUILD.bazel | ||
| helpers.ts | ||
| http_providers_spec.ts | ||
| invalid_two_way_bindings_spec.ts | ||
| project_tsconfig_paths_spec.ts | ||
| standalone_migration_spec.ts | ||