OS Manuals

/usr/bin/bats

Bash Automated Testing System

From bats 1.12.0-r4 (os), captured 2026-11-05 by running bats --help (exit 0). permalink

Bats 1.12.0
Usage: bats [OPTIONS] <tests>
       bats [-h | -v]

  <tests> is the path to a Bats test file, or the path to a directory
  containing Bats test files (ending with ".bats")

  -c, --count               Count test cases without running any tests
  --code-quote-style <style>
                            A two character string of code quote delimiters
                            or 'custom' which requires setting $BATS_BEGIN_CODE_QUOTE and
                            $BATS_END_CODE_QUOTE. Can also be set via $BATS_CODE_QUOTE_STYLE
  --line-reference-format   Controls how file/line references e.g. in stack traces are printed:
                              - comma_line (default): a.bats, line 1
                              - colon:  a.bats:1
                              - uri: file:///tests/a.bats:1
                              - custom: provide your own via defining bats_format_file_line_reference_custom
                                        with parameters <filename> <line>, store via `printf -v "$output"`
  -f, --filter <regex>      Only run tests that match the regular expression
  --filter-status <status>  Only run tests with the given status in the last completed (no CTRL+C/SIGINT) run.
                            Valid <status> values are:
                              failed - runs tests that failed or were not present in the last run
                              missed - runs tests that were not present in the last run
  --filter-tags <comma-separated-tag-list>
                            Only run tests that match all the tags in the list (&&).
                            You can negate a tag via prepending '!'.
                            Specifying this flag multiple times allows for logical or (||):
                            `--filter-tags A,B --filter-tags A,!C` matches tags (A && B) || (A && !C)
  -F, --formatter <type>    Switch between formatters: pretty (default),
                              tap (default w/o term), tap13, junit, /<absolute path to formatter>
  --gather-test-outputs-in <directory>
                            Gather the output of failing *and* passing tests
                            as files in directory (if existing, must be empty)
  -h, --help                Display this help message
  -j, --jobs <jobs>         Number of parallel jobs (requires GNU parallel or shenwei356/rush)
  --parallel-binary-name    Name of parallel binary
  --no-tempdir-cleanup      Preserve test output temporary directory
  --no-parallelize-across-files
                            Serialize test file execution instead of running
                            them in parallel (requires --jobs >1)
  --no-parallelize-within-files
                            Serialize test execution within files instead of
                            running them in parallel (requires --jobs >1)
  --report-formatter <type> Switch between reporters (same options as --formatter)
  -o, --output <dir>        Directory to write report files (must exist)
  -p, --pretty              Shorthand for "--formatter pretty"
  --print-output-on-failure Automatically print the value of `$output` on failed tests
  -r, --recursive           Include tests in subdirectories
  --show-output-of-passing-tests
                            Print output of passing tests
  -t, --tap                 Shorthand for "--formatter tap"
  -T, --timing              Add timing information to tests
  -x, --trace               Print test commands as they are executed (like `set -x`)
  --verbose-run             Make `run` print `$output` by default
  -v, --version             Display the version number

  For more information, see https://github.com/bats-core/bats-core
Options (23)
OptionDescriptionSource
-c, --countCount test cases without running any testshelp
--code-quote-style styleA two character string of code quote delimiters or 'custom' which requires setting $BATS_BEGIN_CODE_QUOTE and $BATS_END_CODE_QUOTE.help
--line-reference-formatControls how file/line references e.g. in stack traces are printed:help
-f, --filter regexOnly run tests that match the regular expressionhelp
--filter-status statusOnly run tests with the given status in the last completed (no CTRL+C/SIGINT) run.help
--filter-tags comma-separated-tag-listOnly run tests that match all the tags in the list (&&).help
-F, --formatter typeSwitch between formatters: pretty (default), tap (default w/o term), tap13, junit, /<absolute path to formatter>help
--gather-test-outputs-in directoryGather the output of failing *and* passing tests as files in directory (if existing, must be empty)help
-h, --helpDisplay this help messagehelp
-j, --jobs jobsNumber of parallel jobs (requires GNU parallel or shenwei356/rush)help
--parallel-binary-nameName of parallel binaryhelp
--no-tempdir-cleanupPreserve test output temporary directoryhelp
--no-parallelize-across-filesSerialize test file execution instead of running them in parallel (requires --jobs >1)help
--no-parallelize-within-filesSerialize test execution within files instead of running them in parallel (requires --jobs >1)help
-o, --output dirDirectory to write report files (must exist)help
-p, --prettyShorthand for "--formatter pretty"help
-r, --recursiveInclude tests in subdirectorieshelp
--show-output-of-passing-testsPrint output of passing testshelp
-t, --tapShorthand for "--formatter tap"help
-T, --timingAdd timing information to testshelp
-x, --tracePrint test commands as they are executed (like `set -x`)help
--verbose-runMake `run` print `$output` by defaulthelp
-v, --versionDisplay the version numberhelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.