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鈥檒l 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 · 6 comments

Comments

Projects
None yet
3 participants
@g-harel
Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

commented Oct 15, 2018

Confirmed:

@g-harel

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Member

commented Oct 15, 2018

@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

This comment has been minimized.

Copy link
Contributor Author

commented Oct 15, 2018

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

@SimenB SimenB closed this in ec87f3d Oct 16, 2018

@simontabor

This comment has been minimized.

Copy link

commented Mar 8, 2019

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

This comment has been minimized.

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.