istanbul

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

Minimal code to use Istanbul programmatically

我的梦境 提交于 2020-01-22 20:16:11
问题 I want to execute the command istanbul cover node_modules/mocha/bin/_mocha dist/test using the Istanbul programmatic API. But the docs don't say much about it, besides that everything is possible and linking to the enormous API documentation. I couldn't find any short example on the internet. I do not want to spawn a child process or use another module from NPM. I know how to run Mocha programmatically without coverage, so that is not the problem. 回答1: I figured out one way to do this, but it

LCOV.INFO has absolute path for SF

最后都变了- 提交于 2020-01-14 06:17:28
问题 I need to have relative path as value of SF: parameter in the lcov.info file generated by karma coverage. This is to enable SonarQube to gather the info to display the coverage. Currently, the SF parameter is having complete absolute path , e.g. c:\abc\xyz....\src\bar\foo.js I need to have SF: src\bar\foo.js Is there a way to achieve this? 回答1: Unfortunately it is still impossible out of the box. To fix the issue you can either: use istanbul merged with this request, process the output file

angular cli exclude files/directory for `ng test --code-coverage`

跟風遠走 提交于 2020-01-09 19:47:08
问题 I am running the following command to unit test and generate code code coverage report. ng test --code-coverage It is working fine and writing code coverage report in coverage folder. In this I got all files and directory coverage report But I want to exclude specific files/directory let say src/app/quote/services/generated . How to do that? 回答1: Updated September 2019 On angular cli 6, angular-cli.json has been renamed to angular.json which contains the configuration. In angular.json ,

Run project exsiting HTML file after code coverage finish in grunt

假装没事ソ 提交于 2020-01-07 07:43:51
问题 I've node app which use grunt to generate code coverage report this report is located under and I was able to run it manually myAPP -coverage -index.html I want that when the task of coverage will finish and the report is generated to run this index.html in the browser,how should I do that? I found this https://www.npmjs.com/package/grunt-run but its not working I try many ways grunt.initConfig({ run: { commands: { exec: '/coverage/lcov-report/index.html', } } }); or grunt.initConfig({ run: {

Instanbul Keeps Dumping Coverage Report HTML files in wrong directory

别来无恙 提交于 2020-01-03 06:19:27
问题 Here's my config file: module.exports = function(config) { config.set({ basePath: './', autoWatch: true, frameworks: ['jasmine'], files: [ '../public_html/libs/mylib/lib.js', '../public_html/libs/mylib/utility.js', '../public_html/libs/mylib/config/*.js', '../public_html/libs/mylib/enumerations.js', '../public_html/libs/mylib/apiComm.js', '../public_html/libs/mylib/baseObject.js', '../public_html/libs/mylib/book.js', '../public_html/libs/mylib/file.js', '../public_html/libs/mylib/library.js',

Webpack Karma Istanbul Remapping for TypeScript

跟風遠走 提交于 2020-01-01 02:27:07
问题 I'm developing a client-side app and I'm having trouble with creating the right Karma configs. Right now, I have my setup as follows: Webpack: Using ts-loader, compiles TypeScript, assets etc. Karma: Using the webpack plugin, loads the Webpack config (which uses ts-loader), then runs all unit tests with Jasmine + PhantomJS The unit tests all run fine, but I haven't figured out a way to handle the webpack istanbul remapping. Karma-webpacks seems to not be generating source maps to allow the

Generate HTML code coverage reports with intern

一个人想着一个人 提交于 2019-12-25 02:43:31
问题 The intern testing framework (http://theintern.io) comes with built in istanbul support. Adding lcov to the reports array generates only a lcov.info file which might be converted with genhtml : define({ // .. reporters: [ 'lcov' ], //.. }); Is it possible to generate a full html report? 回答1: You can use the 'lcovhtml' (Intern 1.4–2.2) or 'LcovHtml' (Intern 3+) reporter to generate a full HTML coverage report. 来源: https://stackoverflow.com/questions/20090890/generate-html-code-coverage-reports

Full Gulp Istanbul Coverage Report

不羁岁月 提交于 2019-12-21 03:33:36
问题 I am using gulp-istanbul to generate JavaScript unit test coverage reports through Gulp. Is there a way to configure Istanbul to generate a full coverage report of all the JS files in my gulp stream, and not just the files touched by a test case. I'm working on a project with a lot of JS, but no unit tests, and we are trying to increase the test coverage. I would like to have a coverage report that starts by show 0% coverage for most of our files, but over time will present an increasing