From 6b42c17b5331cf83b866ae5a577ee2ab8ebd785c Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Sat, 9 Nov 2024 12:48:32 +0100 Subject: [PATCH 1/4] chore: intentional new line at the end of each test run --- src/console_results.sh | 4 +++- src/runner.sh | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/console_results.sh b/src/console_results.sh index f1783663..4e963f47 100644 --- a/src/console_results.sh +++ b/src/console_results.sh @@ -12,7 +12,9 @@ function console_results::render_result() { return 1 fi - echo "" + if env::is_simple_output_enabled; then + printf "\n\n" + fi local total_tests=0 ((total_tests += $(state::get_tests_passed))) || true diff --git a/src/runner.sh b/src/runner.sh index 727e1377..764b82b8 100755 --- a/src/runner.sh +++ b/src/runner.sh @@ -105,6 +105,10 @@ function runner::call_test_functions() { done unset function_name done + + if ! env::is_simple_output_enabled; then + echo "" + fi } function runner::render_running_file_header() { From ce91453fc193268a9dae478d378c682fc914e5b3 Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Sat, 9 Nov 2024 12:55:34 +0100 Subject: [PATCH 2/4] fix: new lines on console results for simple output --- src/console_results.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/console_results.sh b/src/console_results.sh index 4e963f47..b2ef8c2f 100644 --- a/src/console_results.sh +++ b/src/console_results.sh @@ -264,7 +264,10 @@ function console_results::print_failing_tests_and_reset() { local total_failed total_failed=$(state::get_tests_failed) - echo "" + if env::is_simple_output_enabled; then + printf "\n\n" + fi + if [[ "$total_failed" -eq 1 ]]; then echo -e "${_COLOR_BOLD}There was 1 failure:${_COLOR_DEFAULT}\n" else From 11979aa652777f6d9a3c096009483cf7c44f28c4 Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Sat, 9 Nov 2024 13:02:55 +0100 Subject: [PATCH 3/4] fix: acceptance tests snapshots --- src/console_results.sh | 2 ++ ...and_line_test_sh.test_all_tests_files_with_wildcard.snapshot | 1 + ...ine_test_sh.test_all_tests_files_within_a_directory.snapshot | 1 + ....test_bashunit_when_a_test_passes_simple_output_env.snapshot | 1 + ...st_bashunit_when_a_test_passes_simple_output_option.snapshot | 1 + ...st_sh.test_bashunit_argument_overloads_default_path.snapshot | 1 - ...hunit_path_test_sh.test_bashunit_with_argument_path.snapshot | 1 + ...it_path_test_sh.test_bashunit_with_env_default_path.snapshot | 1 + ...lure_test_sh.test_bashunit_when_stop_on_failure_env.snapshot | 1 - ...e_test_sh.test_bashunit_when_stop_on_failure_option.snapshot | 1 - 10 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/console_results.sh b/src/console_results.sh index b2ef8c2f..1429c227 100644 --- a/src/console_results.sh +++ b/src/console_results.sh @@ -276,5 +276,7 @@ function console_results::print_failing_tests_and_reset() { sed '${/^$/d;}' "$FAILURES_OUTPUT_PATH" | sed 's/^/|/' rm "$FAILURES_OUTPUT_PATH" + + echo "" fi } diff --git a/tests/acceptance/snapshots/bashunit_find_tests_command_line_test_sh.test_all_tests_files_with_wildcard.snapshot b/tests/acceptance/snapshots/bashunit_find_tests_command_line_test_sh.test_all_tests_files_with_wildcard.snapshot index e0c51a9a..474df364 100644 --- a/tests/acceptance/snapshots/bashunit_find_tests_command_line_test_sh.test_all_tests_files_with_wildcard.snapshot +++ b/tests/acceptance/snapshots/bashunit_find_tests_command_line_test_sh.test_all_tests_files_with_wildcard.snapshot @@ -1,6 +1,7 @@ Running ./tests/acceptance/fixtures/tests_path/a_test.sh ✓ Passed: Assert greater and less than ✓ Passed: Assert empty + Running ./tests/acceptance/fixtures/tests_path/other_test.sh ✓ Passed: Assert same ✓ Passed: Assert contains diff --git a/tests/acceptance/snapshots/bashunit_find_tests_command_line_test_sh.test_all_tests_files_within_a_directory.snapshot b/tests/acceptance/snapshots/bashunit_find_tests_command_line_test_sh.test_all_tests_files_within_a_directory.snapshot index e0c51a9a..474df364 100644 --- a/tests/acceptance/snapshots/bashunit_find_tests_command_line_test_sh.test_all_tests_files_within_a_directory.snapshot +++ b/tests/acceptance/snapshots/bashunit_find_tests_command_line_test_sh.test_all_tests_files_within_a_directory.snapshot @@ -1,6 +1,7 @@ Running ./tests/acceptance/fixtures/tests_path/a_test.sh ✓ Passed: Assert greater and less than ✓ Passed: Assert empty + Running ./tests/acceptance/fixtures/tests_path/other_test.sh ✓ Passed: Assert same ✓ Passed: Assert contains diff --git a/tests/acceptance/snapshots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_env.snapshot b/tests/acceptance/snapshots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_env.snapshot index 3d4daf1d..da114271 100644 --- a/tests/acceptance/snapshots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_env.snapshot +++ b/tests/acceptance/snapshots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_env.snapshot @@ -1,4 +1,5 @@ .... + Tests:  4 passed, 4 total Assertions: 6 passed, 6 total diff --git a/tests/acceptance/snapshots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_option.snapshot b/tests/acceptance/snapshots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_option.snapshot index 3d4daf1d..da114271 100644 --- a/tests/acceptance/snapshots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_option.snapshot +++ b/tests/acceptance/snapshots/bashunit_pass_test_sh.test_bashunit_when_a_test_passes_simple_output_option.snapshot @@ -1,4 +1,5 @@ .... + Tests:  4 passed, 4 total Assertions: 6 passed, 6 total diff --git a/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_argument_overloads_default_path.snapshot b/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_argument_overloads_default_path.snapshot index e0ec79df..3fc304ab 100644 --- a/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_argument_overloads_default_path.snapshot +++ b/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_argument_overloads_default_path.snapshot @@ -1,4 +1,3 @@ - Tests:  0 total Assertions: 0 total diff --git a/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_with_argument_path.snapshot b/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_with_argument_path.snapshot index 1a618d8c..c43659c8 100644 --- a/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_with_argument_path.snapshot +++ b/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_with_argument_path.snapshot @@ -1,6 +1,7 @@ Running tests/acceptance/fixtures/tests_path/a_test.sh ✓ Passed: Assert greater and less than ✓ Passed: Assert empty + Running tests/acceptance/fixtures/tests_path/other_test.sh ✓ Passed: Assert same ✓ Passed: Assert contains diff --git a/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_with_env_default_path.snapshot b/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_with_env_default_path.snapshot index 1a618d8c..c43659c8 100644 --- a/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_with_env_default_path.snapshot +++ b/tests/acceptance/snapshots/bashunit_path_test_sh.test_bashunit_with_env_default_path.snapshot @@ -1,6 +1,7 @@ Running tests/acceptance/fixtures/tests_path/a_test.sh ✓ Passed: Assert greater and less than ✓ Passed: Assert empty + Running tests/acceptance/fixtures/tests_path/other_test.sh ✓ Passed: Assert same ✓ Passed: Assert contains diff --git a/tests/acceptance/snapshots/bashunit_stop_on_failure_test_sh.test_bashunit_when_stop_on_failure_env.snapshot b/tests/acceptance/snapshots/bashunit_stop_on_failure_test_sh.test_bashunit_when_stop_on_failure_env.snapshot index 250bb252..4b7f2bd4 100644 --- a/tests/acceptance/snapshots/bashunit_stop_on_failure_test_sh.test_bashunit_when_stop_on_failure_env.snapshot +++ b/tests/acceptance/snapshots/bashunit_stop_on_failure_test_sh.test_bashunit_when_stop_on_failure_env.snapshot @@ -5,7 +5,6 @@ but got  '2' Stop on failure enabled... - There was 1 failure: |1) ./tests/acceptance/fixtures/test_bashunit_when_stop_on_failure.sh diff --git a/tests/acceptance/snapshots/bashunit_stop_on_failure_test_sh.test_bashunit_when_stop_on_failure_option.snapshot b/tests/acceptance/snapshots/bashunit_stop_on_failure_test_sh.test_bashunit_when_stop_on_failure_option.snapshot index 250bb252..4b7f2bd4 100644 --- a/tests/acceptance/snapshots/bashunit_stop_on_failure_test_sh.test_bashunit_when_stop_on_failure_option.snapshot +++ b/tests/acceptance/snapshots/bashunit_stop_on_failure_test_sh.test_bashunit_when_stop_on_failure_option.snapshot @@ -5,7 +5,6 @@ but got  '2' Stop on failure enabled... - There was 1 failure: |1) ./tests/acceptance/fixtures/test_bashunit_when_stop_on_failure.sh From 27bed9c62e1bd6efccff36e5cae6900bdede6f5a Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Sat, 9 Nov 2024 13:05:16 +0100 Subject: [PATCH 4/4] docs: update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d2a7c88..07307b0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- Improved output: adding a space between each test file + ## [0.18.0](https://github.com/TypedDevs/bashunit/compare/0.17.0...0.18.0) - 2024-10-16 - Added `-p|--parallel` to enable running tests in parallel