I am able to generate the code coverage using the context menu. I would like to generate the coverage file whenever I run the unit test. It tried setting this JSON property "EnableCodeCoverage": "true" but it is not working.
Is that possible?
Regards,
Raaj
You found a bug in Chutzpah! I just committed a fix and will include this when I make the next release (probably 3.2.5)
Related
In my AngularJs application I'm using Jasmine and Karma for my unit tests.
Recently, after a chrome update (now on 72.0.3626.81) my unit tests starting failing locally (with no change to code). I believe the error is a result of my coverage tool Instanbul.
Sometimes the error appears like this:
An error was thrown in afterAll Uncaught ReferenceError: __cov_iuQO6FdumXRPLjSMopb0JQ is not defined thrown
Other times it will appear within a specific unit test (not sure why).
I searched my application and the only file this __cov_ variable could come from is the return of a function within the Instanbul package, generateTrackerVar() within instrumenter.js.
As no code changes were made I assume that the issue is with the new version of Chrome, perhaps the security settings.
My question what permissions would karama-coverage/istanbul require? OR if anyone suspects the issue isn't security based, then what could be causing this error?
Thanks
EDIT:
I have tried to disable web security in my gulpfile like so:
browsers: [ 'Chrome_without_security' ],
customLaunchers: {
Chrome_without_security: {
base: 'Chrome',
flags: ['--disable-web-security']
}
},
But this didn't solve the issue. Is there a way to set the chrome version in this config?
I managed to solve this by figuring out the hashcode after __cov_ was related to a test file that was throwing an error. I don't know why the error didn't just appear as it normally would, that will be another problem to solve.
For now I managed to figure out the file by logging in instrumenter.js within the instanbul package. Then by removing my coverage tool I figured out the source of the issue. Simply removing the coverage tool would give me a different error but not tell me which file so I needed to do both.
Maybe someone can help me with my requirement.
I am in trouble about the compilation of a new custom version of extjs with the use of sencha CMD.
For this purpose, I have used diffetent instructions but with the same result. No one instructions seems to work properly or perhaps there is something wrog in these instruction.
Below, the latest instruction that I have used for produce a custom version for extjs.
sencha -debug=false compile -classpath="ext-6.0.1\classic\classic\src,ext-6.0.1\packages\core\src,ext-6.0.1\classic\classic\overrides" exclude -namespace Ext.chart and concat -yui -out "test.js"
After the execution of this instruction, in test.js I have a custom version of Extjs. Or so it seems.
If I include this js into a webpage, with Firefox and firebug I can see this error of javascript: "Ext is undefined".
From this, I have some questions:
First of all, is this the correct way to compile a new custom version?
The classpath parameter is correct? There are other paths to include?
In the instruction above, I have included the "exclude" parameter (for the namespace Ext.chart) but if I search in the output file I can found the related functions. It is the correct way to exclude something? Ext.chart is the namespace or is the class name?
Thanks in advance for any reply.
Lorenzo.
I want to use this plugin with Jenkins.
My project is in Maven(Java) with IntelliJ.
How to give path to test analyzer to produce reports by using TestNG result's report???
Please explain with all the steps
I was making mistake to give path for
/target/surefire-reports/testng-results.xml This is correct
\target\surefire-reports\testng-results.xml This is wrong
I am trying to setup the code coverage for the unit test for the angular project. However it gave me some error. Refer https://github.com/angular-class/NG6-starter/issues/58
Refer to implementation in : https://github.com/packetloop/angular-webpack/blob/master/karma.conf.js
and also add a file : https://github.com/packetloop/angular-webpack/blob/master/spec.js
I use code coverage with npm and grunt locally, but I want to demonstrate this in browser.
If I open a codepen how can I have code coverage generated in browser?
Please show an example of this.
Here I'm testing a controller and Jasmine tests the code but I would like to know if it's 100% covered and show that in browser.
http://codepen.io/clouddueling/pen/Jwaru?editors=001
Could I submit my code to a server? Have it tested instantly elsewhere like on heroku and get the results?
Can Instanbul run in the client somehow and output an html report or json string?
You can use Blanket.js, which support jasmine test runner, to run a code coverage in the browser itself.
Here is a PLUNKER demonstrating your sample app and specs. Few key points to note here are:
<!-- Use of data-cover provided by blanket to test coverage of concerned file -->
<script type="text/javascript" src="app.js" data-cover></script>
Blanket js needs an adapter for jasmine. jasmine-blanket.js is the adapter shown in the plunker.
I preferred plunker over codepen. Hope that helps. Isn't this slick?
update 9-11-2017 blanket.js project is not actively maintained, you can see on their github repository.
If you need coverage and complexity data I highly suggest that you look into Grunt.io and NPM. NPM has packages like karma-coverage that will give you a full coverage report of your application. Grunt is your automated task runner for these reports. But remember that 100% coverage is not always relevant. This is where a tool for code complexity comes in. I use the NPM package grunt-complexity along with karma-coverage to see what is not covered and then to determine how much value full test coverage is in that part of my code.
Eghead has a nice grunt intro video https://egghead.io/lessons/gruntjs-introduction-to-grunt.
Hope this helps a bit,
Jordan