Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Getting coverage from test files #8325

Closed
karanjitsingh opened this issue Apr 13, 2019 · 2 comments
Closed

Getting coverage from test files #8325

karanjitsingh opened this issue Apr 13, 2019 · 2 comments

Comments

@karanjitsingh
Copy link
Contributor

I'm trying to collect coverage for test files along with product code. But coverage results only show the product coverage.

<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1555161111641" clover="3.2.0">
  <project timestamp="1555161111641" name="All files">
    <metrics statements="2" coveredstatements="2" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="1" elements="3" coveredelements="3" complexity="0" loc="2" ncloc="2" packages="1" files="1" classes="1"/>
    <file name="index.js" path="D:\jest-test-coverage\index.js">
      <metrics statements="2" coveredstatements="2" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="1"/>
      <line num="2" count="1" type="stmt"/>
      <line num="5" count="1" type="stmt"/>
    </file>
  </project>
</coverage>

Is there any way to force jest to collect test file coverage as well?

Sample repo https://github.com/karanjitsingh/jest-test-coverage
Running jest with --config config.js

// config.js
module.exports = {
    collectCoverage: true,
    coverageReporters: ['clover']
}

Currently using 24.7.1

@karanjitsingh
Copy link
Contributor Author

karanjitsingh commented Apr 13, 2019

found the option forceCoverageMatch from #5081 #5067

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant