I am running some Cypress tests and after test execution I want to deploy the test results. However if there is a test failure the build fails with an “exit code 1” and doesn’t deploy.
Any way around this? I’ve tried adding:
[build]
ignore = “exit 1”
… which makes no difference.
Any suggestions?
luke
June 1, 2021, 7:54am
2
Hi, @calibre . The build.ignore
setting doesn’t control which exit codes are ignored which is why setting it to that value didn’t work.
If you always want to deploy even when the tests fail, you can append ; true
to the build command.
For example, if this were the build command and test commands:
npm run build && run_some_tests.sh
then you can force the test script’s exit code to be ignored like this:
npm run build && run_some_tests.sh ; true
Note, this isn’t recommended. However, if you wanted to ignore the exit code of the tests and always deploy, this would do just that.
If there are other questions, please let us know.