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.

Wrong coverage when running Jest with nested config

See original GitHub issue

This is my Jest configuration:

module.exports = {
  "roots": [
    "../../src/"
  ],
  "moduleDirectories": [
    "node_modules",
    "src"
  ],
  "moduleFileExtensions": [
    "js",
    "jsx"
  ],
  "moduleNameMapper": {
    "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
      "./mocks/file.mock.js",
    "^.+\\.(css|scss)$": "identity-obj-proxy"
  },
  "setupFiles": [
    "./enzyme.config.js"
  ],
  "snapshotSerializers": [
    "enzyme-to-json/serializer"
  ],
  "testURL": "http://localhost/",
  "transform": {
    "^.+\\.jsx?$": "babel-jest"
  }
};

This is my Enzyme file configuration:

import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

configure({ adapter: new Adapter() });

And this is the screenshot: 2018-08-15-11-07-07

It seems like all the test are detected and passing but the files table is displayed incorrectly. The table should have all files that are shown above and not a configuration file.

I run the tests with the following command: jest --config devtools/test/jest.config.js --coverage --no-cache

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
thymikeecommented, Aug 15, 2018

Can you setup a downloadable repro so we can investigate if this is a bug?

0reactions
github-actions[bot]commented, Apr 30, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run Jest test and collect coverage from all files in a specific ...
I am using the following code to run Jest test on specific file. jest utils.spec.js --collectCoverageFrom=**/utils.js.
Read more >
Configuring Jest
The bail config option can be used here to have Jest stop running tests ... The babel and v8 coverage providers use /*...
Read more >
Configuring code coverage in Jest, the right way
In this brief tutorial we see how to configure code coverage for Jest, the right way.
Read more >
Jest Tutorial - JavaScript Unit Testing Using Jest Framework
In this Jest tutorial, we will learn about various Jest features, Jest matchers and how to use Jest framework for JavaScript Unit Testing....
Read more >
Mocha - the fun, simple, flexible JavaScript test framework
Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, ... Configuring Mocha (Node.js); The test/ Directory; Error Codes ......
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