I have Jest tests running in a Pipeline Job. I am using Jest in version
.gitlab-ci.yml has 2 jobs:
prep: stage: prep script: - node -v - npm -v - npm ci unit tests: stage: test script: - 'npm run test' coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/ artifacts: when: always paths: - test/unit/coverage - test/unit/reporter expire_in: 1 day except: - schedules
package.json has this script:
"test": "jest --coverage"
The tests succeed but the job fails with exit code 1. When I run
npm run test on my local machine it returns exit code 0. Running it with a local gitlab runner (
14.9.1) the job succeeds as well. I expect the job to succeed as long as the tests succeed even if there are console.errors in the log.
I am using Gitlab.com.
console.error to an empty function. Without having
console.error in the log the job succeeds. I’ve tried it with a shared runner (
14.9.0~beta.68.g1283960c) and a self hosted runner (
13.4.0) with the same result (failing when there are console.errors).