ng-mocks: Rendering mocked component ContentChildren broken after upgrade to ng9

I have a number of component tests in my project, that rely on mocking dependant components. Many of them also rely on rendering outlets in these mocked components.

Before upgrading to ng9, everything worked just fine. But now, the outlets aren’t rendered anymore. I’ve tried debugging, and I’ve found that in this line https://github.com/ike18t/ng-mocks/blob/master/lib/mock-component/mock-component.ts#L118 the viewContainer is always undefined.

If I explicitly disable Ivy ("angularCompilerOptions": { "enableIvy": false } in tsconfig.spec.ts), tests pass. The problem is, I can’t easily do this for all my libs.

Have you tried unit testing with Ivy enabled? I don’t see it being disabled in your tsconfig

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (14 by maintainers)

Commits related to this issue

Most upvoted comments

I found a way, finalising changes.

I was able to reproduce the issue, working on fix.

Awesome, I’ll release a new version on Sunday.

Hi @twjacobsen, 9.3.0 has been released, please let me know if you meet any issues.

@satanTime My co-worker has just verified, that your fix is working as it should 👍 Sorry for the delay!

On first sight, it looks very promising. I still have a few failing tests, but I’ll have to verify if they’re related to ng-mocks or some other Ivy related change - I’ll do this monday 😃

Awesome! Thanks! I’ll check next days.