Skip to content

Commit af5bead

Browse files
authored
Improve the output adding a space between each test file (#385)
1 parent 409b8d5 commit af5bead

12 files changed

+23
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
- Improved output: adding a space between each test file
6+
37
## [0.18.0](https://github.com/TypedDevs/bashunit/compare/0.17.0...0.18.0) - 2024-10-16
48

59
- Added `-p|--parallel` to enable running tests in parallel

src/console_results.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ function console_results::render_result() {
1212
return 1
1313
fi
1414

15-
echo ""
15+
if env::is_simple_output_enabled; then
16+
printf "\n\n"
17+
fi
1618

1719
local total_tests=0
1820
((total_tests += $(state::get_tests_passed))) || true
@@ -262,7 +264,10 @@ function console_results::print_failing_tests_and_reset() {
262264
local total_failed
263265
total_failed=$(state::get_tests_failed)
264266

265-
echo ""
267+
if env::is_simple_output_enabled; then
268+
printf "\n\n"
269+
fi
270+
266271
if [[ "$total_failed" -eq 1 ]]; then
267272
echo -e "${_COLOR_BOLD}There was 1 failure:${_COLOR_DEFAULT}\n"
268273
else
@@ -271,5 +276,7 @@ function console_results::print_failing_tests_and_reset() {
271276

272277
sed '${/^$/d;}' "$FAILURES_OUTPUT_PATH" | sed 's/^/|/'
273278
rm "$FAILURES_OUTPUT_PATH"
279+
280+
echo ""
274281
fi
275282
}

src/runner.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ function runner::call_test_functions() {
105105
done
106106
unset function_name
107107
done
108+
109+
if ! env::is_simple_output_enabled; then
110+
echo ""
111+
fi
108112
}
109113

110114
function runner::render_running_file_header() {

tests/acceptance/snapshots/bashunit_find_tests_command_line_test_sh.test_all_tests_files_with_wildcard.snapshot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Running ./tests/acceptance/fixtures/tests_path/a_test.sh
22
✓ Passed: Assert greater and less than
33
✓ Passed: Assert empty
4+
45
Running ./tests/acceptance/fixtures/tests_path/other_test.sh
56
✓ Passed: Assert same
67
✓ Passed: Assert contains

tests/acceptance/snapshots/bashunit_find_tests_command_line_test_sh.test_all_tests_files_within_a_directory.snapshot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Running ./tests/acceptance/fixtures/tests_path/a_test.sh
22
✓ Passed: Assert greater and less than
33
✓ Passed: Assert empty
4+
45
Running ./tests/acceptance/fixtures/tests_path/other_test.sh
56
✓ Passed: Assert same
67
✓ Passed: Assert contains

tests/acceptance/snapshots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_env.snapshot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
....
2+
23
Tests:  4 passed, 4 total
34
Assertions: 6 passed, 6 total
45

tests/acceptance/snapshots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_option.snapshot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
....
2+
23
Tests:  4 passed, 4 total
34
Assertions: 6 passed, 6 total
45

tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_argument_overloads_default_path.snapshot

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Tests:  0 total
32
Assertions: 0 total
43

tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_with_argument_path.snapshot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Running tests/acceptance/fixtures/tests_path/a_test.sh
22
✓ Passed: Assert greater and less than
33
✓ Passed: Assert empty
4+
45
Running tests/acceptance/fixtures/tests_path/other_test.sh
56
✓ Passed: Assert same
67
✓ Passed: Assert contains

tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_with_env_default_path.snapshot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Running tests/acceptance/fixtures/tests_path/a_test.sh
22
✓ Passed: Assert greater and less than
33
✓ Passed: Assert empty
4+
45
Running tests/acceptance/fixtures/tests_path/other_test.sh
56
✓ Passed: Assert same
67
✓ Passed: Assert contains

0 commit comments

Comments
 (0)