$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 是一款shell 脚本集成开发环境,支持 bats-core 的 $BATS_TEST_TIMEOUT - 立即试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款