bats-core Run Configurations

bats-core tests are run via “Run Configurations”, which is a feature of your JetBrains IDE. Please refer to JetBrains’ help to learn more about it.

Standard Settings

You can configure these properties for bats-core run configurations. They correspond to the available command line options of bats-core.

Properties of bats-core Run Configurations
Properties of bats-core Run Configurations
Test data path
The file to a .bats file or a directory, which contains .bats files.
Test name pattern
A regular expression to define the tests, which should be executed in the source defined by Test data path . Only test method names, which match against the pattern, are executed.
Recursive
If this is enabled and Test data path points to a directory, then .bats files will be searched recursively in the directory and all subdirectories. Disable this if you only want to limit the test search to just the directory you specified.
Interpreter path
bats-core itself is a Bash script and needs a Bash interpreter to run. This setting defines the path to the interpreter, which should be used.
By default, the default Bash interpreter is used, which is defined in your application settings. If you want to override this, then use this property to specify your own path. Please note, that this may prevent sharing your bats-core run configurations within your team.
Program arguments
Additional command line arguments to pass to the bats-core test runner.
Working directory
The working directory for the bats-core test runner. By default, it’s the directory, where your source is located:
  • if the source is a file, then it’s the parent directory.
  • if the source is a directory, then it’s also used as working directory.
Environment variables
This allows you to define the environment variables of your test runner. For example, it’s possible that some tests expect a specific environment.

Extended Settings

This collapsible section contains additional settings, which are usually not needed.

Number of parallel jobs
This defines how many tests are run in parallel. The GNU parallel command has to be installed to use this feature.
Add interpreter directory to $PATH
This adds the directory, where the interpreter is located, to the $PATH environment variable before bats–core is executed. If the directory is already in $PATH, then it’s not added again.
This is especially useful on Windows, where bats-core execution would fail otherwise. For example, if your interpreter is C:\\Program Files\\Git\\bin\bash.exe, then C:\\Program Files\\Git\\bin\ is added to your $PATH environment as first entry.
Tag filter
Tags support the fine-grained filtering of executed tests. Please refer to bats-core’s documentation how to add tags to bats-core tests and how to define tag filters to learn more about tags.
Each line of this list is passed with its own --filter-tags argument on the command line.

Logging Settings

Make run print $output by default
By default, the bats-core run command does not print the output of the executed command. If this flag is enabled, the output of run commands will be printed.
Print output of passing tests
If this flag is enabled, then the output of passing tests will be printed.
Print output of failing tests
If this flag is enabled, then $output of failing tests will be printed.
Directory for test output files
If defined, then the output of passing and failing tests will be stored as files inside this directory. The directory must exist and must be empty.
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal