angular/packages/core/schematics
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
..
migrations fix(migrations): migrate HttpClientTestingModule in test modules (#55803) 2024-05-15 08:45:31 -07:00
ng-generate refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:21 -07:00
test fix(migrations): migrate HttpClientTestingModule in test modules (#55803) 2024-05-15 08:45:31 -07:00
utils fix(migrations): handle more cases in HttpClientModule migration (#55640) 2024-05-06 12:29:18 -07:00
BUILD.bazel feat(migrations): Migration schematics for HttpClientModule (#54020) 2024-04-23 12:12:31 -07:00
collection.json feat(core): Add schematic to migrate control flow syntax (#52035) 2023-10-10 11:33:00 -07:00
migrations.json feat(migrations): Migration schematics for HttpClientModule (#54020) 2024-04-23 12:12:31 -07:00
package.json refactor(migrations): ensure CommonJS migrations can be accessed (#43657) 2021-10-04 16:24:48 -07:00
tsconfig.json build: align schematics tsconfig with rest of the project (#51969) 2023-10-04 07:28:41 -07:00