Lazy router setup in non-application tests#17557
Lazy router setup in non-application tests#17557xg-wang wants to merge 2 commits intoemberjs:masterfrom
Conversation
During non setupApplicationTests type tests, the Router being injected into service:router and service:routing does not start routing, in which it initializes its _routerMicrolib. Public API on service:router will throw in those tests. This commit will trigger startRouting on router, in non application tests the router service should just work.
|
I’m not sure this is the right direction. IMHO, tests that need the router (e.g. those testing generated href’s or things using the router service) should call |
463e8fd to
6d3f888
Compare
|
Can you explain the reason behind this? I think if using router service in a component is not discouraged the test experience should also be out-of-box. |
|
Hmm, @xg-wang I think I've made a mistake here, sorry for the double speak (between #16831 (comment) and my comments here). What do you think about reviving these changes? |
|
Is it better to handle this here or to call |
IMHO, most rendering tests aren't going to need the router. So eagerly setting it up in all tests is a bit wasteful. |
During non
setupApplicationTeststype tests, the Router being injected intoservice:routerandservice:routingdoes not start routing, in which it initializes its_routerMicrolib. Calling public API onservice:routerwill throw in those tests.This commit will trigger startRouting on router, in non application tests the router service should just work™.
Link tested on xg-wang/__router-test@df28714. It fails on travis-ci.
Fixes #16831