-
-
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: "Nested" module replacement not working as expected #4486
Comments
Hi @twjacobsen, thanks for the report. A failing example: https://github.com/satanTime/ng-mocks/blob/issues/4486/tests/issue-4486/angular.spec.ts |
Thanks for "correcting" the test. I'm having a hard time reading in the docs, if it's possible to replace a submodule using |
Hi @twjacobsen, what you do is expected and is exactly how the I've submitted a bug here: angular/angular#48432 |
Thanks a lot for finding that. I'll follow these issues closely :) |
Hey @twjacobsen, Thanks for the update. |
hi @satanTime I see there is test PR, any chance for some progress ? |
Hi @dtomaszewski, it's still blocked on Angular's side: angular/angular#48432 |
Description of the bug
When using
MockBuilder
to replace a module import with a "testing module", that in turn imports some other "testing module" is not working as expected. The declarations of the sub-testing-module is not made available in my testsAn example of the bug
Link: https://stackblitz.com/edit/github-fvnrfv?file=src/test.spec.ts
Expected vs actual behavior
Expected behaviour: The component in the test renders as
name: sandboxt one testing two
Actual behaviour: The component in the test renders as
name: sandboxt one two
, indicating the nested module declarations are not usedBrief of the code structure:
Component imports
Sub1Module
which declaresComponent1
and importsSub2Module
.Sub2Module
declaresComponent2
.In test,
Sub1Module
is replaced withSub1TestingModule
, which declaresComponent1
but importsSub2TestingModule
.Sub2TestingModule
declaresComponentTesting2
.The selectors of
Component2
andComponentTesting2
are identical.We've been using this pattern for regular non-standalone component testing, where we usually provide all module imports manually to the test. We've started using MockBuilder for standalone component testing, since it's very convenient - but this one issue is a pretty big deal to us :(
The text was updated successfully, but these errors were encountered: