Serverside JS coverage for IntelliJ - javascript

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

Related

Code coverage for nightwatch.js using Istanbul

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.

using Code coverage using QUnit and Teamcity

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.

Concurrent/Continuous Testing for nodejs (ncrunch for nodejs)

I'm a big fan of the continuous testing setup offered by NCrunch in Visual Studio, and would love to have a similar setup with nodejs.
When writing JavaScript in node I use Sublime Text 2 as my editor, with tests written using Mocha.
I wondered if there was software (or a ST2 plugin) for achieving similar concurrent testing to that offered by NCrunch when writing .NET code?
After doing some digging around I've decided that the solution for the moment is:
Server-side: Mocha
mocha -w test
Using mocha's built-in watch functionality.
Client-side: Testacular
I'm now using testacular, which is truly awesome. It would be great it if had hooks for running the server-side watch progress in tandem, but not really a problem.
I haven't tried it myself yet but it looks promising: wallaby.js The description from the website has the following description
Wallaby.js is an intelligent test runner for JavaScript that
continuously runs your tests. It reports code coverage and other
results directly to your code editor immediately as you change your
code. Wallaby.js uses various tricks to run your tests as fast as
possible, such as dependency analysis to only execute tests affected
by your code changes and parallel test execution.

What code quality / code coverage tools are available for checking Javascript tests in Jasmine?

What code quality / code coverage tools are available for Jasmine?
Working in Rails 3.2.2.
You may be able to use a combination of JsTestDriver and this Jasmine adapter to get coverage metrics.
JSCoverage is a C based tool that you run out of band from the command line..
JesCov is a Java solution that supports Jasmine. You can run it from the command line, so it should be fairly straight forward to integrate with Rails if the system has a JRE:
java -jar jescov-0.0.1.jar one.js two.js three.js
I looked into JesCov several months ago for a Grails project, but never actually tried it out, so I'd be interested in hearing your experience if you do try it.

How can i create JavaScript test cases

I am currently working on some test cases for my website. I've managed to test the back-end functionality using the simple-test framework.
I have some important javascript tools that requires some automatic testing. I know javascript is a client side language and it requires a browser, i am just wondering if its something i can do.
Notice the test must run from Linux CLI.
Thank you
You can install node.js with jasmine-node package to run your tests using cli:
Here's a brief intro to Jasmine:
http://net.tutsplus.com/tutorials/javascript-ajax/testing-your-javascript-with-jasmine/
And here's a tutorial on jasmine-node:
http://www.2ality.com/2011/10/jasmine.html
PS
In order to reference the code to be tested is useful to grasp how module.export works on Node.js ... here you'll find all the info you need to get started: http://jherdman.github.com/2010-04-05/understanding-nodejs-require.html (broken link) http://coppieters.blogspot.be/2013/03/tutorial-explaining-module-export.html
Jasmine is what I use for my Javascript testing. It can be found here :
https://github.com/jasmine/jasmine (UPDATED -- 2015)
I also use JSCoverage to test my code coverage. It can be found here : http://siliconforks.com/jscoverage/
There are several unit testing frameworks out there written for javascript.
You could try something like:
http://testcase.rubyforge.org/

Categories