nyc

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

被刻印的时光 ゝ 提交于 2021-02-08 10:59:50
问题 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 recommended replacement is nyc . I'm having trouble replacing istanbul-combine with nyc in the Makefile . I succeeded in merging my separate coverage results (json) files into a single coverage-final.json file (this SO question), but now I need to generate

Cannot get code coverage with Cypress + Istanbul

廉价感情. 提交于 2021-01-22 08:04:42
问题 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 cypress:open But the generated coverage report is empty: $ cat coverage/coverage-final.json {} Same result when I execute the command: $ npx nyc report --report-dir ./coverage --temp-dir .nyc_output --reporter=text ----------|----------|----------|------

Cannot get code coverage with Cypress + Istanbul

假装没事ソ 提交于 2021-01-22 08:02:39
问题 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 cypress:open But the generated coverage report is empty: $ cat coverage/coverage-final.json {} Same result when I execute the command: $ npx nyc report --report-dir ./coverage --temp-dir .nyc_output --reporter=text ----------|----------|----------|------

How do I run nyc merge from Makefile?

丶灬走出姿态 提交于 2020-05-17 07:08:08
问题 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 recommended replacement is nyc . I'm having trouble replacing istanbul-combine with nyc in the Makefile . Here's are my attempts at merging the data (not even trying to get a report yet): #1 @for dir in $(shell ls -d coverage/*/); do \ echo "Merging $${dir}

What is instrumentation in nyc istanbul?

僤鯓⒐⒋嵵緔 提交于 2020-02-24 10:42:10
问题 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 coverage/instrument then run the application and tries hitting an endpoint npm start but when I do above, it doesn't generate a file in nyc_output thus can't report anything. Do I have to finish the nyc instrument command? how to do so? 回答1: nyc instrument is used to

nyc (istanbul) exclude test code from coverage reports

陌路散爱 提交于 2020-02-03 10:10:50
问题 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 ## types I made for a few dependencies that didn't have them └─ build ├─ lib ## compiled project code (ES5 + type info, with inline sourcemaps), *.js and *.d.ts └─ test ## compiled test specs (ES5 + type info, with inline sourcemaps), *.spec.js and *.spec.d

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

北城余情 提交于 2019-12-23 04:16:07
问题 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 easily. Unfortunately, there is no type definition file in the chai-bytes module and there is no definition at @types/chai-bytes available. Therefore, I have written my own type definition file for the chai-bytes plugin (which is very simple), but during