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
4
votes
0 answers

How to configure code coverage for .vue files?

I'm using mocha for unit testing and want to add code coverage. For that I added nyc, istanbul-instrumenter-loader and babel-plugin-istanbul and it works for js files but for .vue files an error occurs: "TypeError: Cannot read property…
4
votes
1 answer

How to filter out certain patterns from mocha/nyc test coverage (Node.js)?

In mocha.opts, I am sure how to set-up coverage pattern that needs to be taken into account but not sure how to include the patterns that has to be filtered-out? For example, I have the file mocha.opts containing coverage patterns which is passed as…
Prem
  • 5,685
  • 15
  • 52
  • 95
4
votes
1 answer

Error getting the coverage report with rewire / cross-env

I'm trying to get the coverage report using nyc and it works well if I'm not using the cross-env plugin. cross-env NODE_ENV=test nyc mocha --ui bdd --reporter spec --colors --require babel-core/register tests --recursive executing this command the…
mirg
  • 312
  • 2
  • 16
4
votes
2 answers

GitLab Code Coverage Badge Not Showing

I have CI setup for a GitLab repository and the job contains the following output to the STDOUT. =============================== Coverage summary =============================== Statements : 94.25% ( 291/333 ) Branches : 62.29% ( 53/75…
Adam Thompson
  • 3,278
  • 3
  • 22
  • 37
4
votes
1 answer

Mocha, nyc code coverage - only testing files are covered

I wrote some tests which are placed in folder test. Problem: Code coverage with nyc shows me only CC for tested files. Want: All files in src to be shown in CC with precentage, even if they are not tested yet. My package json and…
Ernesto
  • 950
  • 1
  • 14
  • 31
4
votes
1 answer

IstanbulJS code coverage shows 100% line coverage but <100% statement coverage

I am using Mocha for my test runner, and nyc for the test reporter. I don't see any uncovered lines and was wondering if anyone knows how can be uncovered functions and statements, while every line is covered.…
Bryan Lemon
  • 61
  • 1
  • 5
3
votes
1 answer

How to exclude files from Istanbul nyc coverage report

I am just trying to get the basic Istanbul nyc exclude functionality working on my project but so far I cannot. I am using Cypress to run e2e test on my react.js application. My coverage report seems to be working fine other than it not ignoring the…
Trevor Dammon
  • 199
  • 1
  • 10
3
votes
0 answers

Zero nyc coverage on Next server tested using Playwright

I'm trying to get test coverage using Playwright on a Next server. The tests reside in e2e-tests/ and the server in frontend/. After some struggles I've managed to end up some json files looking like the following inside e2e-tests/.nyc_output: { …
jorgen
  • 3,425
  • 4
  • 31
  • 53
3
votes
1 answer

No coverage information is generated for vscode extension using nyc

To generate the code coverage report for vscode extension, i am using nyc and running those via vscode test runner. Source : https://code.visualstudio.com/api/working-with-extensions/testing-extension Project structure: out -test -unit …
noor
  • 2,954
  • 2
  • 16
  • 29
3
votes
1 answer

Merging coverage reports from nyc

I have a CI running that does mocha test executions in parallel. A test execution creates a coverage report coverage.json - generated by nyc. I want to have a final merged report from all of the coverage.jsons in lcov format, but I can't manage to…
alexibbb
  • 93
  • 8
3
votes
1 answer

How to use code coverage in Electron app which uses Angular?

I write an Electron app (in TypeScript) that I test through AVA (in whose tests I use Spectron to communicate with the app). The (browser) content of my app is generated by using Angular. I execute the tests via: npm run ava All of this works…
Daniel Stephens
  • 2,371
  • 8
  • 34
  • 86
3
votes
1 answer

'npm run coverage' is not updating lcov.info file

I am working on an API that makes use of nyc and mocha. I noticed recently that npm run coverage no longer updates lcov.file and lcov-report folder but it updates every other file/folder in the coverage folder. I can also see that the coverage is…
Fiyin Akinsiku
  • 166
  • 2
  • 13
3
votes
4 answers

nyc not recognized as command after installation

I am very new to node.js, npm and JavaScript but for code coverage trying with Istanbul tool and hence installed nyc with npm i nyc referring to https://www.npmjs.com/package/nyc which outputs like C:\Users\user>npm i nyc npm WARN saveError ENOENT:…
Alpha
  • 13,320
  • 27
  • 96
  • 163
3
votes
1 answer

How to include monorepo packages in Cypress code coverage

I have multi packages in monorepo. /pkg1 /pkg2 /pkg3 - react-app - cypress - src - package.json I am using @cypress/instrument-cra to collect coverage and it works only to cover the code inside react-app. I need to go further…
Jalal
  • 3,308
  • 4
  • 35
  • 43
3
votes
2 answers

Can we merge coverage report Jest and Mocha?

I have problem when merge coverage report Jest and mocha. Currently I can export each of them. Any solution for this? Coverage Jest: Coverage Mocha:
1 2
3
9 10