Has anyone got code coverage to work for nightwatch.js with Istanbul. Any helpful links to the configuration will be appreciated.
nightwatch.js is a wrapper on Selenium. I believe what you attempting is not going to work with nightwatch.
See also
Selenium: Is there any JS (JavaScript) code coverage tool which we can integrate with Selenium Server/RC where one user recommended JsTestDriver instead.
Related
I am trying to set up code coverage for my node.js unit tests.
What I am trying to do is this:
Use WebStorm for running tests
use Mocha (and co-mocha) as a testing framework
Use yield and generators for making my test code more readable
See the code coverage of my source code via the WebStorm UI (hoping to see my source code files color-coded according to code coverage)
The first two points are going fine, the third one is tripping me up.
Unfortunately WebStorm doesn't provide coverage support for Mocha:( Please follow WEB-10373 for updates
I am actually configuring Jenkins to make a continuous integration of a JS project with unit tests. My problem is that after many researchs I didn't found any tutorial or information about how to proceed to write unit tests in Jenkins.
Should I use other tools (grunt, ant...) with Jenkins or could it do the job alone ? Is there any important plugin to install to make it work ?
Thanks for your answers
What you're looking for is a testing framework with a JUnit Reporter. Jenkins can read your test results from the JUnit report and give you metrics from them.
Jenkins is just for handling the automation of building your code and running your tests in whatever language you need. In order to use it for that, you need to use something like Karma, Mocha, HapiJS's Lab, Unit.js, Jasmine, etc. to actually write and test with.
We run a CI environment with Jenkins and the Project using ExtJS 5.1.1.
I try using Chutzpah test runner, using mocha framework JavaScript unit test.
With JavaScript test without ExtJS 5.1.1 testing run successfully.
But JavaScript with reference ext-all.js, there are no success. We have time out error in Blanket.js (error blanket_mocha.js line 5141) testing are not succeed and coverage.xml won't generate.
I'm looking for other way how run JavaScript test (ExtJS) in Jenkins with mocha framework and have code coverage report generate.
We already have Grunt run in Jenkins to do JavaScript combine and minify.
Is this possible to using Grunt to run mocha test and generate coverage.xml in Jenkins?
Please help me out if there is some other way to achieve the same thing. Any suggestion are highly appreciated.
Is there a way to run code coverage without browser in intelliJ?
http://www.jetbrains.com/webstorm/webhelp/monitoring-code-coverage-for-javascript.html
This is only coverage tutorial by Jetbrains, but both of these require a browser, so i can't test my Node.js code. I bet i'm not the only one who want's a coverage report of their Node.js code using IntelliJ :)
Karma and JsTestDriver seems both to run tests in browser so no Node.js code can be tested with those. I can anyways run mocha tests straight from idea, but without coverage.
There is no such feature in WebStorm. Please vote for WEB-10373
Edited 2018
It's been possible already quite a long now. Works out of the box for jest, and apparently very easy for mocha/istanbul too, see:
https://www.jetbrains.com/help/idea/running-unit-tests-on-mocha.html#ws_mocha_code_coverage
https://www.jetbrains.com/help/idea/running-unit-tests-on-jest.html#ws_jest_code_coverage
Actually I am in the process to run my javascript code on teamcity using QUnit+ phantomjs.
(using this link as reference:http://thomasardal.com/running-qunit-tests-on-teamcity/)
And at least the execution of my tests using phantomjs looks ok on my local machine so in someway I am happy :). But that is not all what i want to do, I would like to add code coverage to my javascript tests and run it from our Teamcity server. is there some way to do that? jscoverage is an alternative?
thank you!
As to TeamCity side of the question, here are some notes in the doc on how external coverage results can be integrated into TeamCity.