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.

Coverage for untested files?

See original GitHub issue

How do I use the coverage for untested files feature introduced in the 4.1.0 release? I reviewed the PR and it looks like I have to specify an onCover function, however, I’m currently specifying my istanbul config via a .babelrc file:

{
  "env": {
    "test": {
      "plugins": [
        [ "istanbul", {
          "exclude": [
            "tests/index.js",
            "tests/testutils/**/*.js",
            "**/*.spec.js"
          ]
        }]
      ]
    }
  },
}

This has treated me very well so far, but it seems incompatible with the final version of this feature? (The originally proposed version seemed much more amenable, but alas was cut.) I’m running tests via karma, so have a karma config available if that helps.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
paul-sachscommented, May 23, 2017

@marco-ramirez my example repo does everything @bcoe mentioned, it still does not work. It is using istanbul in it’s babelrc file. I call nyc --all ava as suggested. And untested files are still not shown in the coverage report.

0reactions
kopachcommented, Nov 23, 2019

For those, who use Karma + Istanbul – take a look on this plugin https://github.com/kopach/karma-sabarivka-reporter. Configuration is simple like that:

reporters: [
  // ...
  'sabarivka'
  // ...
],
coverageReporter: {
    include: 'src/**/!(*.spec|*.module|environment*).ts',
    exclude: 'src/main.ts',
    // ...
},

It works, as already mentioned above – by scanning your project files and adding them to coverage report.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable Coverage on Untested Files - Jest - Stack Overflow
When using @vue/cli-plugin-unit-jest, I am receiving coverage reports each time I run my unit tests, regardless of whether I have the -- ...
Read more >
Jest is "stuck" on only generating coverage for tested files ...
I've tried creating a whole new config, one with coverage and one without, and then just running the base command, and that doesn't...
Read more >
Configuring code coverage in Jest, the right way
Code coverage makes possible to spot untested paths in our code. It is an important metric for determining the health of a project....
Read more >
Full code-coverage with Jest - tsmx
The answer is that Jest will – by default – only collect coverage stats for touched source files. Without this empty suite referencing ......
Read more >
Jest code coverage report explained - Emma Goto
How to track untested files with Jest's code coverage report ... By default, Jest will calculate coverage for each file that has a...
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