When my test failed on CI Jest return code 1 enter image description here But build task succeeded complete. How to make Jest return always code 0, when test pass or failed?

1 Answers

1
Avi On Best Solutions

This is not possible to Jest return always code 0 because Jest return code 0 when all test run/passed successfully and In your scenario your test failed and if any of the test failed then it gives you error code 1.So, that is the usual behavior in this scenario. If you want to overcome from this issue kindly use any HTML reporter their are many packages in the npm. like jest-html-reporter or jest-stare because of this packages you are to see which test case failed and what are the reason.

See jest issues here(closed/open) for more details. Hope it would helpful for you