$BATS_TEST_TIMEOUT  –  Number of seconds when tests time out

$BATS_TEST_TIMEOUT defines the number of seconds, after which a test (including setup()) will be terminated. This must be configured in setup_file() or earlier. If you define it inside setup_file(), please make sure to export.

Please refer to the bats-core manual for further details how to use this.

Examples

Timeout after 5 seconds
1
2
3
4
5
6
7
#!/usr/bin/env bats    
BATS_TEST_TIMEOUT=5
      
@test "Timeout test" {
    # this will always time out
    sleep 10
}
BashSupport Pro is a shell script IDE with support for bats-core’s $BATS_TEST_TIMEOUTtry it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal