'how to integrate jenkins with react jest testing results
My project is using reatJS, jest is used to do unit test and also to generate the coverage report. Now I need to use jenkins to automatically build the project and then display the code coverate result. But I could not find out jest plugins in jenkins. Can anyone show me how you integrate jest with jenkins for displaying coverage? Thanks
Solution 1:[1]
If cannot get a direct plugin use html publish plugin and point it to your test reports index.html or whatever equivalent to it. I have got a custom inhouse made oracle db code quality tool which produces html result and using html publish plugin brings up a link in the lefthand side of the job which shows the job. You may use emailext plugin to send the result aswell.
Solution 2:[2]
Just to complement the above answer, in my case I'm using a declarative pipeline, and in the final stage after we run the tests in the pipelines we added.
The folder where the results are generated is coverage/lcov-report
, and we need to point to the index.html
generated.
i.e.
publishHTML(target: [
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'coverage/lcov-report',
reportFiles: 'index.html',
reportName: 'Jest Test Reports',
reportTitles: 'Jest Test Reports'])
more documentation here: https://plugins.jenkins.io/htmlpublisher/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Subrata Fouzdar |
Solution 2 | Jheison Rodriguez |