Configuration
Environment configuration to control bashunit behavior.
It serves to configure the behavior of bashunit in your project. You need to create a .env
file in the root directory, but you can give it another name if you pass it as an argument to the command with --env
option.
Default path
DEFAULT_PATH=directory|file
Specifies the directory
or file
containing the tests to be run. empty
by default.
If a directory is specified, it will execute tests within files ending in test.sh
.
If you use wildcards, bashunit will run any tests it finds.
# all tests inside the tests directory
DEFAULT_PATH=tests
# concrete test by full path
DEFAULT_PATH=tests/example_test.sh
# all test matching given wildcard
DEFAULT_PATH=tests/**/*_test.sh
Output
SIMPLE_OUTPUT=true|false
Enables simplified output to the console. false
by default.
Verbose is the default output, but it can be overridden by the environment configuration.
Similar as using -s|--simple|-v|--verbose
option on the command line.
....
SIMPLE_OUTPUT=true
Running tests/functional/logic_test.sh
✓ Passed: Other way of using the exit code
✓ Passed: Should validate a non ok exit code
✓ Passed: Should validate an ok exit code
✓ Passed: Text should be equal
SIMPLE_OUTPUT=false
Stop on failure
STOP_ON_FAILURE=true|false
Force to stop the runner right after encountering one failing test. false
by default.
Similar as using -S|--stop-on-failure
option on the command line.
Show header
SHOW_HEADER=true|false
HEADER_ASCII_ART=true|false
Specifies if you want to show the bashunit header. true
by default.
Additionally, you can use the env-var HEADER_ASCII_ART
to display bashunit in ASCII. false
by default.
✓ Passed: foo bar
SHOW_HEADER=false
bashunit - 0.11.0
✓ Passed: foo bar
SHOW_HEADER=true
__ _ _
| |__ __ _ ___| |__ __ __ ____ (_) |_
| '_ \ / _' / __| '_ \| | | | '_ \| | __|
| |_) | (_| \__ \ | | | |_| | | | | | |_
|_.__/ \__,_|___/_| |_|\___/|_| |_|_|\__|
0.11.0
✓ Passed: foo bar
SHOW_HEADER=true
HEADER_ASCII_ART=true
Show execution time
SHOW_EXECUTION_TIME=true|false
Specifies if you want to display the execution time after running bashunit. true
by default.
WARNING
This feature is not available on macOS.
✓ Passed: foo bar
Tests: 1 passed, 1 total
Assertions: 3 passed, 3 total
All tests passed
Time taken: 14 ms
SHOW_EXECUTION_TIMEER=true
✓ Passed: foo bar
Tests: 1 passed, 1 total
Assertions: 3 passed, 3 total
All tests passed
SHOW_EXECUTION_TIMEER=false