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.

constructor coverage for angular is not correct anymore

See original GitHub issue

Current Behavior

If you have an angular lib/app with an injection in the constructor then jest reports it as a not covered branch

Expected Behavior

This is a regression I remember it working around 1-2 weeks ago (was 14.6.5 I think).

Steps to Reproduce

Reproduction: https://github.com/nrwl/nx-examples/pull/229

  • run yarn nx products:test
  • observe the coverage info

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:8
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
willyboycommented, Oct 4, 2022

Removing emitDecoratorMetadata from tsconfig.base.json did it for me - I also removed some hardcoded istanbul/karma/jasmine deps

0reactions
dolphiniglecommented, Dec 5, 2022

Can confirm this issue still exists in 15.2.4. Removing emitDecoratorMetadata everywhere in our code fixes this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 4 unittest coverage not 100% due to contructor
I noticed that my coverage from my Angular 4 project is not 100% due to problems with the constructor. I'm using the default...
Read more >
Component testing scenarios - Angular
In a spec with multiple expectations, it can help clarify what went wrong and which expectation failed. The remaining tests confirm the logic...
Read more >
Unit Tests, How to Write Testable Code, and Why It Matters
We will see that writing unit tests and generating testable code is not just ... us to cover all cases, ensuring that every...
Read more >
Testing Components depending on Services - Testing Angular
It does not have side effects we need to suppress in the testing ... constant later to check whether the Component uses the...
Read more >
Changelog - Cypress Documentation
Cypress component tests now correctly load assets with Angular. Fixes #23797. Imports in component testing support files are no longer tree-shaken by Webpack....
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