Skip to content

fix(migrations): handle more cases in HttpClientModule migration#55640

Closed
cexbrayat wants to merge 1 commit intoangular:mainfrom
cexbrayat:fix/http-client-module-migration
Closed

fix(migrations): handle more cases in HttpClientModule migration#55640
cexbrayat wants to merge 1 commit intoangular:mainfrom
cexbrayat:fix/http-client-module-migration

Conversation

@cexbrayat
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

This commit handles two cases that were breaking applications when using the new migration:

  • tests using HttpClientModule in TestBed.configureTestingModule were broken as the import was removed, but the module is still present in the test configuration.
  • tests using HttpClientTestingModule were migrated to use provideHttpClient(withInterceptorsFromDi()) but the necessary imports were not added.

What is the new behavior?

It now properly adds provideHttpClient(withInterceptorsFromDi()) and related imports to the test for the tests that were using HttpClientModule
It also adds the necessary imports for provideHttpClient and withInterceptorsFromDi for tests that were using HttpClientTestingModule

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove bot requested a review from dylhunn May 2, 2024 17:14
@cexbrayat cexbrayat requested a review from crisbeto May 2, 2024 17:14
@cexbrayat cexbrayat force-pushed the fix/http-client-module-migration branch 2 times, most recently from 87ec047 to e2330d7 Compare May 2, 2024 17:18
@cexbrayat cexbrayat changed the title fix(migrations): handle more cases in HttpClient migration fix(migrations): handle more cases in HttpClientModule migration May 2, 2024
@AndrewKushnir AndrewKushnir added action: review The PR is still awaiting reviews from at least one requested reviewer area: migrations Issues related to `ng update`/`ng generate` migrations target: rc This PR is targeted for the next release-candidate labels May 2, 2024
@ngbot ngbot bot modified the milestone: Backlog May 2, 2024
@AndrewKushnir AndrewKushnir requested a review from JeanMeche May 2, 2024 22:28
This commit handles two cases that were breaking applications when using the new migration:

- tests using `HttpClientModule` in `TestBed.configureTestingModule` were broken as the import was removed, but the module is still present in the test configuration. It now properly adds `provideHttpClient(withInterceptorsFromDi())` and related imports to the test.
- tests using `HttpClientTestingModule` were migrated to use `provideHttpClient(withInterceptorsFromDi())` but the necessary imports were not added. They are now added by the migration.
@cexbrayat cexbrayat force-pushed the fix/http-client-module-migration branch from e2330d7 to 3937b3b Compare May 4, 2024 17:00
@cexbrayat
Copy link
Member Author

@crisbeto Thank you for the review. I updated the PR with your feedback, PTAL.

@crisbeto crisbeto removed request for JeanMeche and dylhunn May 6, 2024 08:35
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels May 6, 2024
@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository by commit 7a2efd4.

AndrewKushnir pushed a commit that referenced this pull request May 6, 2024
)

This commit handles two cases that were breaking applications when using the new migration:

- tests using `HttpClientModule` in `TestBed.configureTestingModule` were broken as the import was removed, but the module is still present in the test configuration. It now properly adds `provideHttpClient(withInterceptorsFromDi())` and related imports to the test.
- tests using `HttpClientTestingModule` were migrated to use `provideHttpClient(withInterceptorsFromDi())` but the necessary imports were not added. They are now added by the migration.

PR Close #55640
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: migrations Issues related to `ng update`/`ng generate` migrations target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants