Generate Jenkins test results and coverage reports using Ioman and Mocha

I am starting a new project and researching Yeoman and Mocha for use in the project. We use Jenkins for CI.

So far I have figured out how to work with client-side testing, but I'm struggling to generate test results (and ultimately coverage reports) that can be tracked by Jenkins. Has anyone successfully done this?

+6
source share
3 answers

I was able to add code coverage reports to my Jasmine tests using testem. Sam seems to be working with Mocha. https://github.com/airportyh/testem

Follow the instructions in the read me file. It explains how to use testem ci in continuous integration mode.

You will need to get a plugin to connect - https://wiki.jenkins-ci.org/display/JENKINS/TAP+Plugin - from jenkins.

Vytch

+4
source

The xunit reporter works well for creating test reports.

Command line:

mocha -R xunit | grep "<" > reports/mocha.xml

With Jenkins, just “post a JUnit test report”, it should work.

But I still find a solution to publish a coverage report.

+4
source

Not tested, but depending on which test driver you use (mocha, jasmine), it can be as simple as using the right reporter. See for example https://github.com/visionmedia/mocha/issues/83 for mocha.

0
source

All Articles