Questions tagged [nyc]

a command-line interface for the Istanbul code coverage tool.

nyc is a command-line interface for the Istanbul code coverage tool.

147 questions
27
votes
2 answers

Grouping istanbul code coverage report by folder

I'm running a code coverage report for NodeJs using istanbul and the nyc command. I'm using mocha for my unit tests I get a report for each file just as expected, but what I'd like to see is a report that has a single directory summary. Let me…
Ray Perea
  • 5,640
  • 1
  • 35
  • 38
25
votes
4 answers

Jest: How to merge coverage reports from different jest test runs

Has anyone managed to combine test coverage report from two separate jest test runs? I am newbie trying to use the default jest coverage reporters: ["json", "lcov", "text", "clover"] I have tried using nyc to combine coverage-final*.json files from…
anon_dcs3spp
  • 2,342
  • 2
  • 28
  • 62
20
votes
3 answers

How to make test coverage show all vue files in Vue-cli 3 using jest

I am having difficulty trying to set up Vue CLI 3 with Jest to show test coverage. I have done everything possible to make it work, but it is still showing no coverage: Ran all test…
devIT
  • 239
  • 1
  • 3
  • 9
17
votes
3 answers

What is instrumentation in nyc istanbul?

What is instumentation used in nyc? nyc's instrument command can be used to instrument source files outside of the context of your unit-tests: I assume it will do coverage outside unit-testing. I tried it with nyc instrument src…
otong
  • 1,387
  • 2
  • 17
  • 28
17
votes
1 answer

How to debug with VSCode when making a nyc coverage report?

I am trying to debug when running nyc instead of just while running the mocha tests, so I won't have to run tests twice each time. VSCode runs the coverage and shows it to me, but it will not stop or verify breakpoints, how do I set it to properly…
Didi Kohen
  • 560
  • 4
  • 19
16
votes
1 answer

Should .nyc_output be included in .gitignore?

Do we need to include .nyc_output or should we just put that directory in .gitignore
Ole
  • 41,793
  • 59
  • 191
  • 359
13
votes
1 answer

How to run a git pre-commit hook to enforce that test coverage for the staged files doesn't decrease?

I am using jest and istanbul in my ReactJS project to write test cases and check on the test coverage. How do I ensure using a pre-commit hook that test coverage for any file, that I have staged to git, doesn't decrease from its current value before…
Ayan
  • 8,192
  • 4
  • 46
  • 51
13
votes
1 answer

node - how to use source-map with nyc and mocha

So nyc is mangling my files as follows: at _onCreate (src/post/admin.js:1:10453) at doQuery (src/db.js:59:216) at process._tickCallback (internal/process/next_tick.js:68:7) I am unsure of how to use a source map to unmangle this. The docs…
A. L
  • 11,695
  • 23
  • 85
  • 163
12
votes
0 answers

Vue cli 3 - NYC Istanbul code reports not including vue files

I have been trying for hours now to get the istanbul code coverage reports up and running for my new vue (typescript based) project, generated with the vue-cli v3. Whenever I run my tests: (nodemon --exec nyc vue-cli-service test:unit) only the .ts…
Stan Hurks
  • 1,844
  • 4
  • 14
  • 25
12
votes
0 answers

No coverage data with `nyc mocha`

Although my tests run perfectly fine with $ cross-env NODE_ENV=test nyc --require babel-register mocha Everything is zero, and inside the ./coverage dir there is no coverage info too :( My project is very basic…
Jeanluca Scaljeri
  • 26,343
  • 56
  • 205
  • 333
9
votes
3 answers

How to generate nyc report from json results (no .nyc_output)?

I've inherited a JS code base with Jasmine unit tests. The testing framework uses karma and instanbul-combine to get code coverage. It seems istanbul-combine isn't working with present node modules, and besides is no longer maintained: the…
JohnK
  • 6,865
  • 8
  • 49
  • 75
9
votes
3 answers

How to improve puppeteer startup performance during tests

I've written a small crawler with the help of Puppeteer. Now I'm facing the challenge that my tests are rather slowly (> 3 seconds for each test). I've been able to track it down to the launch function of Puppeteer and the usage of…
seasick
  • 473
  • 1
  • 4
  • 15
8
votes
4 answers

Cannot get code coverage with Cypress + Istanbul

I tried setting up code coverage in an Angular 8 project using Cypress and istanbul nyc. I managed to get the code instrumented (the global variable __coverage__ is properly set) : and the coverage file generated in .nyc_output after running…
Majid Laissi
  • 19,188
  • 19
  • 68
  • 105
8
votes
0 answers

Can I use NYC with ESM and Mocha without the "@std/esm" library

I work at a company where @std/esm has not been approved. I have got my Mocha test working like this... // suite.js async function wire(){ await import("./Sanity.spec.mjs"); // eslint-disable-line run(); } wire(); //Sanity.spec.mjs import…
JGleason
  • 3,067
  • 6
  • 20
  • 54
8
votes
1 answer

Tests are passing, coverage is not showing

I'm trying to get nyc ava and babel to all place nice together. I was having an issue where async / await branches were showing as not covered, so this was working, I'm having trouble integrating the babel-plugin-istanbul plugin for tests. I have…
ThomasReggi
  • 55,053
  • 85
  • 237
  • 424
1
2 3
9 10