Closed oscarvaldes closed 4 years ago
I'll do some investigating but I'm assuming it's this line. If that's the case, it would seem there is an undefined provider in your module that has been slipping by in former versions of Shallow-Render..
I'd go into the node_modules/shallow-render/dist/lib/mock-provider.js file and place some console logs to see if you can locate the module that is being mocked to see why the provider is empty.
If there's any way you could reproduce this in a StackBlitz that would be great.
Yeah I'll dive a little deeper and see if I can replicate this on a StackBlitz.
Some more info:
Pretty much all of my shallow tests are currently failing. Even simple tests are failing with this error (testing components with no DI and a module with no providers array). To validate, I rewrote some of the tests with TestBed and they work.
@getsaf I think we can close this. I found a lingering empty Shallow.alwaysMock() in our test configuration that was causing this side effect. Didn't cause an issue with previous versions, but looks like something since 8.0.3 causes breakage. Thanks again!
After upgrading to angular 9 and the latest supported typescript version for angular 3.8.3, I am seeing previous tests that were passing with shallow-render 8.0.3 that are now failing with version 9.0.4 with the error:
Cannot read property 'provide' of undefined
being thrown fromlib/tools/mock-provider.ts
. Are there any known changes that could be causing this? Thanks!