Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nyc equivalent of istanbul command

Tags:

istanbul

nyc

I am trying to convert my istanbul code coverage commands to nyc.

It appears as though nyc is now the command line interface for the istanbul test coverage library.

With istanbul, we'd get coverage like so:

istanbul cover foo.js --dir coverage

then we'd get a consolidated report like so:

istanbul report --dir coverage --include **/*coverage.json lcov

so I am trying to determine what the equivalent command is with nyc -

to get coverage with nyc, it looks like I can do this:

nyc node foo.js  # writes coverage data to .nyc_output

but when I look in .nyc_output, there are a bunch of .json files but they don't seem to have any data in them.

If I try to get a report, using

nyc report --reporter=lcov

That report command doesn't seem to do anything, the .nyc_output directory looks the same as before:

enter image description here

Note I am fine with using configuration files and avoiding extra commands at the command line.

like image 514
Alexander Mills Avatar asked Nov 08 '22 13:11

Alexander Mills


1 Answers

Official documentation proposes using it like this:

nyc --reporter=lcov npm test
like image 170
Jehy Avatar answered Nov 25 '22 22:11

Jehy