-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Bug: ngMocks.globalReplace() doesn't work #6402
Comments
Hi @mfrieling, thanks for reporting. The issue will be fixed with the next release. |
fix(MockBuilder): respects global rules as they would be chain calls #6402
v14.12.0 has been released and contains a fix for the issue. Feel free to reopen the issue or to submit a new one if you meet any problems. |
Still the same issue for version Whereas using |
@satanTime should a new issue be opened? |
Description of the bug
Using Jest,
ngMocks.globalReplace()
intest-setup.ts
doesn't work as expected, compared toMockBuilder(MyComponent).replace(HttpClientModule, HttpClientTestingModule)
.If you have a lot of tests (tested components, services etc.) which depend on HttpClientModule, instead of repeating
MockBuilder(MyComponent).replace(HttpClientModule, HttpClientTestingModule)
in every spec you instead want to just writeMockBuilder(MyComponent)
and put angMocks.globalReplace(HttpClientModule, HttpClientTestingModule)
intotest-setup.ts
.But this doesn't work as expected.
An example of the bug
test-setup.ts
:app.component.spec.ts
:Expected vs actual behavior
This test passes. If I now comment out the
.replace()
line in the spec file and uncomment the corresponding linengMocks.globalReplace()
the test should still pass.Instead I get the following error:
The text was updated successfully, but these errors were encountered: