Search code examples
javascriptcode-coverage

Perform code coverage with JsChilicat


I just found out about JsChilicat and saw the code coverage example and I want to do something similar for my code. As I can see from the GitHub page I have to execute a command in the following manner:

java -jar jschilicat.jar -chilicat -workingDir=/Users/jschilicat/dev/results \ -libs=/dev/libs -src=/dev/src -src-test=/dev/test/

Do I need to write a specific test and place it in the test folder so that code coverage report will be generated? Or I can leave this folder empty?

Thanks in advance.


Solution

  • you have to enable the output reports explicitly with jsChiliCat (Note the -junitReport and -coverage options in the example below).

    The options you provide to the chilicat jar command give you with the ability to set the location of your JS Src, Tests and Libraries. However the GitHub example is incorrect, you need to omit the '=' signs from the command line options. The following example worked for my POC project...

    java -jar lib/jschilicat-dist/libs/jschilicat.jar -chilicat -workingDir target -src src/js -src-test src/test -libs src/lib -junitReport -coverage
    

    HTH,

    Paul