istanbul

Blanket.js vs Istanbul-js vs JSCover

和自甴很熟 提交于 2019-12-20 16:19:04
问题 I am trying to decide on a JS test code coverage tool but cannot see clearly the differences between them. The top hits in Google are blanket.js, istanbul-js and JSCover. Can anyone offer any information on the key differences between them and advantages/disadvantages? Are there any other useful ones out there? 回答1: After some trying around i clearly find istanbul the most convenient tool to bring coverage analysis to a node-js project. its installed with npm install it sets up its behavior

Blanket.js vs Istanbul-js vs JSCover

﹥>﹥吖頭↗ 提交于 2019-12-20 16:16:26
问题 I am trying to decide on a JS test code coverage tool but cannot see clearly the differences between them. The top hits in Google are blanket.js, istanbul-js and JSCover. Can anyone offer any information on the key differences between them and advantages/disadvantages? Are there any other useful ones out there? 回答1: After some trying around i clearly find istanbul the most convenient tool to bring coverage analysis to a node-js project. its installed with npm install it sets up its behavior

SonarQube Analysis not showing code coverage

房东的猫 提交于 2019-12-20 05:02:03
问题 I have a Jenkins project to do SonarQube analysis of my NodeJS project. I added istanbul as a dependency to my project's package.json . In the Jenkins build configuration, first I run a shell script: cd ./project-name npm install node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha path-to-unit-tests node_modules/.bin/istanbul report cobertura cd .. This installs the dependencies, runs the tests and generates a code coverage report and generates a cobertura-coverage.xml file. After the

SonarQube and Lcov report Could not resolve file paths

时光毁灭记忆、已成空白 提交于 2019-12-18 05:04:30
问题 We are trying to make a SonarQube code coverage report for our angular application. We have used Karma to generate a code coverage report and import it into SonarQube analyzer. The SonarQube already has C# coverage for our project, now we want to add JavaScript code coverage as well. Teamcity calls, Karma and it creates a code coverage and put the lcov file and report files into src\Planning.Spa\Coverage\report folder. LCOV File TN: SF:E:/a03/work/bb52cb33e083fc9/src/Planning.Spa/Offer/app

Karma/Istanbul Code Coverage does not find functions and always returns 100%

被刻印的时光 ゝ 提交于 2019-12-17 19:53:40
问题 I am attempting to add Code Coverage for my Karma tests, however although it finds the correct JS files that I'm testing, it does not find the functions inside those files. From what I have read so far I believe it to be to do with the files not being correctly browserified before being passed to istanbul to do the coverage, but admittedly I am new to this so I'm hoping for some suggestions. Here is my JS file(common.js): var applicationSettings = require('./settings'); var common = {

istanbul.yml not being picked up by istanbul

蹲街弑〆低调 提交于 2019-12-13 03:39:42
问题 I'm using istanbul.js and it says I can create a istanbul.yml to configure it, but it's not being picked up automatically. Do I need to configure somewhere that I have created it? Running istanbul like: istanbul cover --report cobertura _mocha test/ works ok. Thanks! Guillermo. 回答1: Make sure you're putting it in the root of the project folder, and that it starts with a "." The correct filename is .istanbul.yml . 来源: https://stackoverflow.com/questions/25537622/istanbul-yml-not-being-picked

Test Coverage React, Istanbul -_registerComponent(…): Target container is not a DOM element

荒凉一梦 提交于 2019-12-12 18:19:49
问题 I am writing an app with react / redux / webpack. I am building out my testing with karma, mocha and want to use istanbul for test coverage. In an attempt to get coverage to work with karma-coverage I have set up the following karma.config.js var argv = require('yargs').argv; var path = require('path'); var webpack = require('webpack'); const PATHS = { test: path.join(__dirname, 'test'), app: path.join(__dirname, 'app'), } module.exports = function(config) { config.set({ // only use PhantomJS

Istanbul cover report is wrong for test with mocha (using Mongoose)

孤街浪徒 提交于 2019-12-12 12:14:37
问题 I've tried Istanbul to get a cover test for my application. All seems to work fine, but some methods are marked as not covered and I'm sure (beacause of logs) that those functions are covered. Here is the code I want to test (using Mongoose) : var mongoose = require('mongoose'), Schema = mongoose.Schema; function BaseSchema(objectName, schema) { // !!! Marke as not covered log.trace('BaseSchema CTOR : objectName=%s schema=%s', objectName, schema); Schema.apply(this, [schema]); ... this

How to test callback function with Jasmine

天大地大妈咪最大 提交于 2019-12-11 17:32:40
问题 Given the function with callback as follows: myfunction('some value', function(){ //do something... }) How can I cover and test it using Jasmine ? It never enters in the flow inside the function(){... callback. Thanks 回答1: In cases like this, there are (at least) two unit tests that you need to create: a test for myFunction a test for the callback So it might look something like this: it('should test myFunction', () => { let spy = jasmine.createSpy(); let result = myFunction(spy); expect(spy)

Node JS test coverage issue with Istanbul

烈酒焚心 提交于 2019-12-10 19:44:02
问题 I am running some node js unit tests using "Istanbul cover test.js", where test.js is the master test file which will call the actual scripts in our codebase. The problem is that the coverage report it generates is only on the test.js file and not on the actual lines of code in the codebase. Pardon me if this is a dumb question, but how do I get it to show coverage for the actual files that the tests refer to? 回答1: You have to run istanbul cover against the tests that are run. The example in