Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins integration with Jest

Is there a way to have Jenkins integration in the Javascript Jest testing framework that is built on top of Jasmine?

I've tried to integrate Jest with jasmine-reporters, but didn't manage to get a JUnit XML output. I installed the reporters for Jasmine 1.3 with npm install jasmine-reporters@~1.0.0 and then in my setupTestFrameworkScriptFile:

require('jasmine-reporters');

jasmine.VERBOSE = true;

jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter({
  savePath: "output/"
}));

When I run jest I get NodeJS attempt: Arguments to path.join must be strings or NodeJS attempt: Object [object Object] has no method 'join'.

like image 485
Alex Palcuie Avatar asked Aug 06 '14 08:08

Alex Palcuie


People also ask

Can you use Jest for integration testing?

In general, Jest can run seven integration tests in parallel.

Can we use Jenkins for Unit Testing?

Jenkins provides an out of box functionality for Junit, and provides a host of plugins for unit testing for other technologies, an example being MSTest for . Net Unit tests. If you go to the link https://wiki.jenkins-ci.org/display/JENKINS/xUnit+Plugin it will give the list of Unit Testing plugins available.


1 Answers

I've managed to get a working version of it in this repo. The problem was I was not mocking path and fs in the test file.

like image 116
Alex Palcuie Avatar answered Nov 02 '22 18:11

Alex Palcuie