I am running karma.js for unit testing and integrating with jenkins pipeline. My goal is to read the type of error thrown from Karma, if it is error related to percentage i want to terminate the job, otherwise continue even if there are other errors like unit test failures etc. (this is a requirement and there are reasons for it.)
I didn't find a way to do this. Any thoughts are appreciated!
karma start ibx-test/olb/karma.conf.js --browsers PhantomJS --log-level warn --single-run
coverageReporter: {
type: 'lcov',
dir: 'unit-tests/coverage/',
check: {
global: {
lines: 100 //This is just for testing
}
}
}
16:17:43 [Unit Test] 09 03 2017 21:17:43.024:ERROR [coverage]: PhantomJS 2.1.1 (Linux 0.0.0): Coverage for lines (90.33%) does not meet global threshold (100%)
EDIT: I found "Process xUnit test result report" in pipeline syntax under "Build step", can i use this somehow? Is there correlation between karma reports and xUnit?