O'Reilly logo

Continuous Integration, Delivery, and Deployment by Sander Rossel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Node.js tests

The first thing we can add to the script are our Node.js tests. We can place this between the Build stage and the Test stage. It is fine to run these tests on Linux and they are pretty lightweight. And we should also not forget to publish our reports except, of course, the Cobertura report, which we cannot publish using the pipeline:

stage('Test NodeJS') {  steps {    node(label: 'linux') {      ws(dir: 'web-shop-pipeline') {        gitlabCommitStatus(name: 'Test NodeJS') {          sh 'node_modules/.bin/istanbul cover node_modules/jasmine-node/bin/jasmine-node -- --junitreport --output node-junit test/spec'          junit 'node-junit/*.xml'          publishHTML target: [            allowMissing: false,            alwaysLinkToLastBuild: false,            keepAll: false, reportDir: 'coverage/lcov-report', ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required