I have my Angular application running fine with Jenkins with all the stages defined. It has almost 600 unit test cases running with headless chrome as a Jenkins stage before build stage. Everything works as expected.
Now the test stage taking 6-10 mins depends on the server load even there are no changes in the spec files. Right now the test is mandatory in the pipeline syntax. I want to make it conditional.
I just want to add the condition in the test stage, not in the build stage. The condition would be, if there are no changes in the .spec file, Jenkins should skip the stage and execute Build stage.
stage('Test') {
steps {
sh 'npm run test:headless'
}
}
Then the build stage:
stage('Build') {
steps {
sh 'npm run build:dev'
}
}
Thanks in advance for your help.