$BATS_TEST_RETRIES  –  Additional attempts to run flaky tests

$BATS_TEST_RETRIES defines the number of additional attempts to run flaky tests. The default value 0 indicates that tests are expected to pass at the first attempt.

Examples

Retry up to three times to run a flaky bats-core test
1
2
3
4
5
BATS_TEST_RETRIES=2 # additional attempts
  
@test "Flaky test" {
  return "$(( RANDOM % 2 ))"
}
BashSupport Pro is a shell script IDE with support for bats-core’s $BATS_TEST_RETRIEStry it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal