angular/packages/core/schematics/test
cexbrayat c4b2f18709 fix(migrations): migrate HttpClientTestingModule in test modules (#55803)
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
2024-05-15 08:45:31 -07:00
..
google3 refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:21 -07:00
all-migrations.spec.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:21 -07:00
BUILD.bazel feat(migrations): Migration schematics for HttpClientModule (#54020) 2024-04-23 12:12:31 -07:00
helpers.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:21 -07:00
http_providers_spec.ts fix(migrations): migrate HttpClientTestingModule in test modules (#55803) 2024-05-15 08:45:31 -07:00
invalid_two_way_bindings_spec.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:21 -07:00
project_tsconfig_paths_spec.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:21 -07:00
standalone_migration_spec.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:21 -07:00