-
Notifications
You must be signed in to change notification settings - Fork 24.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(migrations): migrate HttpClientTestingModule in test modules #55803
Closed
cexbrayat
wants to merge
1
commit into
angular:main
from
cexbrayat:fix/http-client-module-migration-testing-in-modules
Closed
fix(migrations): migrate HttpClientTestingModule in test modules #55803
cexbrayat
wants to merge
1
commit into
angular:main
from
cexbrayat:fix/http-client-module-migration-testing-in-modules
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} ```
crisbeto
approved these changes
May 15, 2024
crisbeto
added
action: merge
The PR is ready for merge by the caretaker
target: rc
This PR is targeted for the next release-candidate
area: migrations
Issues related to `ng update` migrations
labels
May 15, 2024
This PR was merged into the repository by commit 65b7cb2. |
atscott
pushed a commit
that referenced
this pull request
May 15, 2024
) 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
iteriani
pushed a commit
to iteriani/angular
that referenced
this pull request
May 15, 2024
…ular#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 angular#55803
iteriani
pushed a commit
to iteriani/angular
that referenced
this pull request
May 15, 2024
…ular#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 angular#55803
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
action: merge
The PR is ready for merge by the caretaker
area: migrations
Issues related to `ng update` migrations
target: rc
This PR is targeted for the next release-candidate
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The migration was breaking tests with test modules that imported
HttpClientTestingModule
, as it removed the JS imports without migrating the module imports.What is the new behavior?
The migration now handles the case where
HttpClientTestingModule
is used in test modules, by replacing the module import with theprovideHttpClient
andprovideHttpClientTesting
providers.Before:
After:
Does this PR introduce a breaking change?
Other information