1

I want to re-run the whole test suite when any test has status failed. I only found how to re-run the test case but I want to re-run the whole test suite.

  • I'm not sure it's possible. I checked the Jest docs and see no options for this. – Lee Jensen Aug 5 at 16:12
1

The jest command gives an exit code 1 if a test failed, 0 if all tests succeeded.

You could create a bash shell script that looks something like this:

#!/bin/bash
jest

if [ $? -eq 0 ]
then
  echo "The tests succeeded"
  exit 0
else
  echo "The tests failed, running jest again"
  jest
fi

Reads:

| improve this answer | |
  • 2
    Could be shortened to $ jest || jest – pavelsaman Aug 5 at 14:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.