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.

Tests for structural directive fail with "was not found in test template"

See original GitHub issue

First of all, I’d like to thank you for creating such a great library! It already saved us loads of time!

Issue details:

  • When testing structural directives with shallow-render it tests fail with “Error: <DirectiveType> was not found in test template

Steps to reproduce:

Findings: I cloned the source code. Exception is thrown in rendering.ts on line 22. It seems that the code on line 19 this.fixture.debugElement.query(By.directive(this._setup.testComponent)); returns a null object.

I’d be happy to help to resolve the issue if you can point to the right direction.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
getsafcommented, Jul 9, 2018

Hey, just wanted to let you know, I haven’t forgotten about this. It took a little while, but I have a very clean solution for this. It’s coming in the next release.

0reactions
mihalcancommented, Jul 16, 2018

Thanks a lot, I’ll check it out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular testing component with mocked structural directive fails
Following test is failing with a message: Property binding appSome not used by any directive on an embedded template.
Read more >
Error message for missing `*directives` is wrong and confusing
I'm trying to unit test my component that uses custom structural directive. And i want to ignore all not required directives in my...
Read more >
Testing Directives – Testing Angular
An Attribute Directive does not have a template and cannot alter the DOM structure. We have already mentioned the built-in Attribute Directives ......
Read more >
How to test a structural directive in Angular application
Steps for testing are quite close to the steps for testing attribute directives: we need to render a custom template and then to...
Read more >
Structural directives - Angular
This guide is about structural directives and provides conceptual information on how such directives work, how Angular interprets their shorthand syntax, ...
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