Angular unit Testing : TypeError: Cannot read property ‘root’ of undefined

I had the same problem, just figured it out.
Remove the line:

{provide: Router, useValue: mockRouter}

and it will work.

The thing is when you import RouterTestingModule you should remove all router mocked providers, save for ActiveRoute, etc.

Leave a Comment