When I run tests for my Node.js API project, I often find that one or two tests fail due to changes I have made. However, there are many tests, and I have to scroll up a lot to find the failing test and run it again. Is there an easy way to see which test has failed?
Here are a few ways to see which test has failed:
npx jest --bailThis will stop the test run when there’s a single test failure.
Run only failed tests again. For me, this was the easiest way to find out the failed test.
npx jest --onlyFailureswill do the charm.