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
BASHUNIT_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
BASHUNIT_DEFAULT_PATH=tests
# concrete test by full path
BASHUNIT_DEFAULT_PATH=tests/example_test.sh
# all test matching given wildcard
BASHUNIT_DEFAULT_PATH=tests/**/*_test.sh
Output
BASHUNIT_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 | -vvv|--verbose
option on the command line.
....
BASHUNIT_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
BASHUNIT_SIMPLE_OUTPUT=false
Stop on failure
BASHUNIT_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
BASHUNIT_SHOW_HEADER=true|false
BASHUNIT_HEADER_ASCII_ART=true|false
Specify if you want to show the bashunit header. true
by default.
Additionally, you can use the env-var BASHUNIT_HEADER_ASCII_ART
to display bashunit in ASCII. false
by default.
✓ Passed: foo bar
BASHUNIT_SHOW_HEADER=false
bashunit - 0.15.0
✓ Passed: foo bar
BASHUNIT_SHOW_HEADER=true
__ _ _
| |__ __ _ ___| |__ __ __ ____ (_) |_
| '_ \ / _' / __| '_ \| | | | '_ \| | __|
| |_) | (_| \__ \ | | | |_| | | | | | |_
|_.__/ \__,_|___/_| |_|\___/|_| |_|_|\__|
0.15.0
✓ Passed: foo bar
BASHUNIT_SHOW_HEADER=true
BASHUNIT_HEADER_ASCII_ART=true
Show execution time
BASHUNIT_SHOW_EXECUTION_TIME=true|false
Specify if you want to display the execution time after running bashunit. true
by default.
✓ Passed: foo bar
Tests: 1 passed, 1 total
Assertions: 3 passed, 3 total
All tests passed
Time taken: 14 ms
BASHUNIT_SHOW_EXECUTION_TIME=true
✓ Passed: foo bar
Tests: 1 passed, 1 total
Assertions: 3 passed, 3 total
All tests passed
BASHUNIT_SHOW_EXECUTION_TIME=false
Log JUnit
BASHUNIT_LOG_JUNIT=log-junit.xml
Create a report XML file that follows the JUnit XML format and contains information about the test results of your bashunit tests.
Report HTML
BASHUNIT_REPORT_HTML=report.html
Create a report HTML file that contains information about the test results of your bashunit tests.