-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
a way to skip mocks for a particular definition globally #271
Comments
Would be super useful for global services or classes, like loggers, ErroHandler, Router, ActivatedRoute, etc etc. Totally into it ;) The only problem I see is that it may be troublesome to have some implicit stuff happening. That's exactly why I never mock a component by providing its declaring module: I prefer this to be explicit, so I MUST keep track of dependencies & update my tests accordingly. Maybe instanciating sub-factories in the user codebase might be more explicit ? Or config aliases ? Or register providers/tokens, but still need to say "Hey, I want the global mock from that token !" ? This option is, IMO, the one I would prefer. Just provide the token to some method, and poof, my mock is here. |
Hi @GerkinDev, totally agree, I would disallow all that stuff to keep tests' logic explicit, allowing only default mock behavior for observables. Might you give me an example of Back to the topic. A guy in gitter gave a different interesting case. He uses A possible way is Another case I found is to replace And if we have global But for global To recap. The PR has:
If you think that something should be added / changed / improved - just let me know and let's discuss it. |
v11.4.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. |
similar to
defaultMock
, but should allow to specify what should be always kept / mocked with a way to change it later.The text was updated successfully, but these errors were encountered: