question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rendering mocked component ContentChildren broken after upgrade to ng9

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:24 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
satanTimecommented, May 15, 2020

I found a way, finalising changes.

2reactions
satanTimecommented, Apr 18, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rendering mocked component ContentChildren broken after ...
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 ......
Read more >
ContentChildren is not being populated - Stack Overflow
In the ngAfterContentInit() method, I would have expected content children to be populated. Am I missing something? [Update]. So it turns out that...
Read more >
ContentChildren - Angular
Use to get the QueryList of elements or directives from the content DOM. Any time a child element is added, removed, or moved,...
Read more >
mozilla-central: changeset 394048 ...
The view renders // after the following promise (a different ... SINGLE_DEVICE_INFO); clients = ["mock-client"]; result = await component.
Read more >
Angular — Using ContentChildren and ... - Liu Ting Chun
Whenever it is triggered, we grab the latest @ContentChildren . After that, we update our parent component based on our children state.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found