Unit testing and code coverage in js-files


#1

I’ve been writing unit tests for js-files in /site/lib/, and I’ve been trying to find some way to get code coverage running for the tests as well.
Jacoco seems to work fine for .java-files, but is there any way to get coverage for js-files ran through Nashorn?


#2

Hi.

Yes, Jacoco is good for Java files but sadly it does not cover javascript files. Right now it’s not very easy to create a coverage tool for Nashorn. But in Java 9 it should be possible to create some sort of code-coverage tool that uses the same format as Jacoco or Emma.