Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Jest reports coverage data on files that haven't been touched in the tests #4960

Closed
robertmain opened this issue Nov 27, 2017 · 1 comment
Closed

Comments

@robertmain
Copy link

Do you want to request a feature or report a bug?
Report a bug

What is the current behavior?
When running jest with jest --watch, and I save line.test.js it shows 100% statement, branch, function and line coverage for Point.js. That in itself isn't too weird because Point is used whilst testing Line. That is to say one Line is composed of two Point (like high school geometry). See below:
image

In that screenshot it's also showing 100% coverage for parts of the code that are not currently touched by my tests....(for example pureimage.js and named_colors.js). It's almost like it's just picking things at random...

If I run the tests normally with jest things work perfectly and I get results more along the lines of what I would expect(though it's still saying I have 100% coverage in files I have never touched)
image

If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?

  1. If I'm running with --watch (and not --watchAll) it should only report coverage for the things I'm testing/using
  2. It shouldn't be reporting 100% coverage on files that I haven't even touched...

Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.

Node: 8.4.0
NPM: 5.3.0
Jest: 21.2.1

Installed Packages:

esdoc@1.0.4
esdoc-integrate-test-plugin@1.0.0
esdoc-node@1.0.2
esdoc-standard-plugin@1.0.0
jest@21.2.1
jpeg-js@0.0.4
opentype.js@0.4.11
pngjs@0.4.0

Repo Link: https://github.com/robertmain/node-pureimage

@robertmain robertmain changed the title Watch Produces Incorrect Coverage Data Jest Generating Seemingly Random Coverage Data Nov 29, 2017
@robertmain robertmain changed the title Jest Generating Seemingly Random Coverage Data Jest generates seemingly random coverage data Nov 29, 2017
@robertmain robertmain changed the title Jest generates seemingly random coverage data Jest reports coverage data on files that haven't been touched in the tests Dec 1, 2017
@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 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant