Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
"No provider for $scope!" error when testing an ng2 component using an ng1 component #8523
I'm trying to unit-test an ng2 component which is using an ng1 component.
I can unit-test "manually" using something like this "playgroundElement.innerHTML = '';" but there's no way to use "TestComponentBuilder" which sounds more 2016 for me :)
As you can see on this plunker https://plnkr.co/edit/emNmG6?p=preview
The test works when you set the "ng1Style" var to true (using manual ng1 element injection) at "src/main.ts:63" but setting it to false will fail as it will use "TestComponentBuilder".
Do we absolutely have to downgrade ng2 components using ng1 components in order to test them?
Does this mean that once I'll get rid of ng1 components I will have to rewrite all my tests using "TestComponentBuilder".
Thank you guys!
I am going to close this as "won't fix", since the dynamic version of ngUpgrade has been deprecated and this issue refers to a quite old Angular version anyway.
We are also working on some test helpers for the static version of ngUpgrade (e.g. #16848), which should make testing easier (and more idiomatic) in the future.