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

Coverage unknown with exclusion pattern in "testMatch" #7165

Closed
g-harel opened this issue Oct 15, 2018 · 7 comments
Closed

Coverage unknown with exclusion pattern in "testMatch" #7165

g-harel opened this issue Oct 15, 2018 · 7 comments

Comments

@g-harel
Copy link
Contributor

g-harel commented Oct 15, 2018

🐛 Bug Report

Coverage becomes unknown after adding an exclusion patter to the testMatch config option.

|-----------|----------|----------|----------|----------|-------------------|
| File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
|-----------|----------|----------|----------|----------|-------------------|
| All files |  Unknown |  Unknown |  Unknown |  Unknown |                   |
|-----------|----------|----------|----------|----------|-------------------|

To Reproduce

  • Clone example repo + npm install
  • Run jest --coverage (should show unknown coverage)
  • Remove line 11 in package.json
  • Run jest --coverage (should show correct coverage)

Expected behavior

Coverage report should be the same with or without the exclusion pattern.

Link to repl or repo (highly encouraged)

https://github.com/g-harel/jest-7165

Run npx envinfo --preset jest

  System:
    OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
    CPU: x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  Binaries:
    Node: 9.5.0 - ~/.nvm/versions/node/v9.5.0/bin/node
    npm: 6.4.1 - ~/.nvm/versions/node/v9.5.0/bin/npm
  npmPackages:
    jest: ^23.6.0 => 23.6.0
@rickhanlonii
Copy link
Member

Confirmed:

@g-harel
Copy link
Contributor Author

g-harel commented Oct 15, 2018

I'd like to give this one a shot, do you have any pointers?

I have a feeling it is related to the patterns being "inverted" individually instead of as a unit when removing test files from coverage recording.

@rickhanlonii
Copy link
Member

@g-harel that would be great, after getting the repo running locally, I would start in the reporter here and work backward. You may end up here at some point

@g-harel
Copy link
Contributor Author

g-harel commented Oct 15, 2018

Thanks, that's exactly where I needed to check!

@SimenB SimenB closed this as completed in ec87f3d Oct 16, 2018
@simontabor
Copy link

I'm still getting the exact same issue on Jest v24.3.1. Removing the exclusion pattern fixes it.

Jest config:

module.exports = {
  setupFiles: ['<rootDir>/jest-env.js'],
  testMatch: ['**/*.test.js', '!**/*.integ.test.js'],
  testEnvironment: 'node',
  verbose: true,
  collectCoverage: true,
  coverageReporters: ['text', 'html', 'lcov'],
  coverageDirectory: 'coverage/unit',
};

Env info:

  System:
    OS: macOS 10.14
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 8.10.0 - ~/.nvm/versions/node/v8.10.0/bin/node
    Yarn: 1.12.3 - /usr/local/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v8.10.0/bin/npm
  npmPackages:
    jest: ^24.3.1 => 24.3.1

@g-harel
Copy link
Contributor Author

g-harel commented Mar 9, 2019

It seems to be working correctly in g-harel/jest-7165 with v24.3.1 and the test from #7170 is also still passing. It could be a similar reason, but it doesn't look like the exact same cause.

@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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants