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.

113 questions
18
votes
0 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
  • 4,734
  • 1
  • 28
  • 37
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
  • 540
  • 3
  • 18
14
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
  • 179
  • 1
  • 2
  • 8
14
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
  • 29,797
  • 32
  • 110
  • 232
12
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
  • 9,009
  • 15
  • 53
  • 121
11
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
  • 19,619
  • 37
  • 147
  • 259
10
votes
1 answer

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
  • 936
  • 2
  • 12
  • 22
10
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,342
  • 2
  • 11
  • 23
8
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
  • 429
  • 3
  • 14
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
  • 1,612
  • 1
  • 10
  • 31
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
  • 42,912
  • 63
  • 199
  • 343
6
votes
1 answer

TypeScript: Could not find a declaration file for module in unit tests, only

I'm using TypeScript with Visual Studio Code on Windows 10 to develop an NPM module. I use mocha/chai combined with nyc (istanbul) for unit testing and code coverage. For some of my tests I would like to use chai-bytes to compare buffers more…
Michael Schröder
  • 146
  • 1
  • 1
  • 8
6
votes
1 answer

nyc (istanbul) exclude test code from coverage reports

I'm trying to add coverage report generation to a typescript library project. The layout includes these directories: project ├─ src │ ├─ lib ## project code (typescript), *.tsx │ ├─ test ## test specs (typescript), *.spec.tsx │ └─ @types…
ShadSterling
  • 1,499
  • 1
  • 17
  • 39
5
votes
3 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
  • 17,370
  • 17
  • 62
  • 99
5
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
  • 5,592
  • 3
  • 30
  • 37
1
2 3 4 5 6 7 8