Reputation: 169
How to run the azure devops build completely even if there are some failing test cases. With the below mentioned scripts, the build is exiting with error code 1.
azure build pipleline tasks:
- script: "yarn --cwd frontend/ coverage"
enabled: true
displayName: "Run React Code coverage"
Package.json
"test": "react-scripts test --env=jest-environment-jsdom-sixteen",
"coverage": "react-scripts test --coverage --watchAll --env=jest-environment-jsdom-sixteen",
Upvotes: 0
Views: 895
Reputation: 114887
You can add continueOnError: true
to the script step to ignore its failure.
From the docs:
steps:
- script: string # contents of the script to run
displayName: string # friendly name displayed in the UI
name: string # identifier for this step (A-Z, a-z, 0-9, and underscore)
workingDirectory: string # initial working directory for the step
failOnStderr: boolean # if the script writes to stderr, should that be treated as the step failing?
condition: string
continueOnError: boolean # 'true' if future steps should run even if this step fails; defaults to 'false'
enabled: boolean # whether to run this step; defaults to 'true'
target:
container: string # where this step will run; values are the container name or the word 'host'
commands: enum # whether to process all logging commands from this step; values are `any` (default) or `restricted`
timeoutInMinutes: number
env: { string: string } # list of environment variables to add
PS: It's a bad idea to ignore test failures in CI. Instead of ignoring them, what's keeping you from fixing the issue?
Upvotes: 0