-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
"NullInjectorError: No provider for Location!" when using createRoutingFactory #179
Comments
For what I can tell you, Do you use a In the mean time, I think that adding |
To answer your question, I don't use After adding How this fails is localized to As a workaround, I've found that I can use
where At the end of the day, the workaround is fine, but it'd be really cool if I could just use the built in features instead of maintaining stubs for third-party things (i.e. things that I might need to share in other projects). Like I said above, I feel like maybe I'm just doing something wrong here, but let me know what you think. Also, thanks so much for your help! This is really an awesome project, and I'm super grateful for all the effort that you, @NetanelBasal , and the others have put into this. |
We do expose our So, why not use Or what about mocking |
It's great that I can use that stub as a standalone, if need be, but I'd really like to just be able to use it (more or less) like I see here.
Looking at the source for Like I said in my last comment, it'd be really cool if I could just use the built in features instead of maintaining stubs for third-party things, especially if I'm never even directly manipulating those things. Since these things are so integral to almost any project ( While trying to figure this all out, I was looking at the implementation around Please excuse me if I'm coming across presumptuous at all here. I'm certainly no expert when it comes to Angular testing, so I appreciate the help. |
@andy-rash, @dirkluijk will investigate. Don't worry. You're in good hands :) |
Currently on vacation but yeah, I will try to investigate asap! |
Have fun! 🌴 |
@andy-rash can you somehow create a small reproduction so we can test it on our side, please? |
@NetanelBasal Sure thing. This should do it. N.B. it is an Ionic project, but that shouldn't matter for running the tests since it still uses Karma + Jasmine |
Excuse me for the late reaction. I have been on vacation, but this gave me a lot of time to think about this in the back of my head! 😁 🚀 Cause of the issueThe cause of the issue is quite simple: instead of having a real Why no
|
I would go with both 2 and 3. We must add the |
I will submit a PR sometime tomorrow. |
I checked the PR in the example repo, and with |
@andy-rash are you satisfied with the solution? |
@NetanelBasal - very much so! Thank you and @dirkluijk for your help! You guys really are amazing examples when it comes open source project management. Keep up the good work! |
Glad to hear!! 🚀 |
I'm submitting a...
Current behavior
When trying to use
createRoutingFactory
, I get the issue seen here.Expected behavior
createRoutingFactory
should automatically handle mocking the Router, but it appears that it isn't. I feel like I'm probably doing something wrong here.Minimal reproduction of the problem with instructions
For bug reports please provide the STEPS TO REPRODUCE and if possible a MINIMAL DEMO of the problem via
https://stackblitz.com or similar (you can use this template as a starting point: https://bit.ly/2zme3bj).
Constructor for component under test (
TimeEntryPage
):where
ControlNumberService
andTimeoutService
are custom services,ModalController
is an Ionic service, andFormBuilder
,ActivatedRoute
, andRouter
are Angular services.Component test:
What is the motivation / use case for changing the behavior?
N/A
Environment
The text was updated successfully, but these errors were encountered: