help-me-mom / ng-mocks

Angular testing library for mocking components, directives, pipes, services and facilitating TestBed setup
https://www.npmjs.com/package/ng-mocks
MIT License
1.06k stars 77 forks source link

MockBuikder: RouterModule.forChild and multiple components #178

Closed cdupetit closed 4 years ago

cdupetit commented 4 years ago

Hi @satanTime, When I use MockBuilder to test a XComponent included in a RouterModule.forChild route with a YComponent. I get this error :

Error: Component YComponent is not part of any NgModule or the module has not been imported into your module.

To remove error, I should mock the YComponent manually. You can see the error in StackBlitz. The code works fine in production.

angular.json Production : projects -> demo -> architect -> build -> options -> main -> src/main.ts Testing : projects -> demo -> architect -> build -> options -> main -> src/main-testing.ts

Thanks in advance. Best regards. Cyril

satanTime commented 4 years ago

Hi again,

I hope you are doing great.

Thanks for the report. I'll take a look this weekend and release an update on Sunday.

cdupetit commented 4 years ago

I'm on vacation for two weeks starting tonight. So I could not test before my return.

satanTime commented 4 years ago

No worries, take your time and have fun!

cdupetit commented 4 years ago

Thanks