Skip to content

Commit

Permalink
Improve the output adding a space between each test file (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass authored Nov 9, 2024
1 parent 409b8d5 commit af5bead
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 9 additions & 2 deletions src/console_results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -262,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
Expand All @@ -271,5 +276,7 @@ function console_results::print_failing_tests_and_reset() {

sed '${/^$/d;}' "$FAILURES_OUTPUT_PATH" | sed 's/^/|/'
rm "$FAILURES_OUTPUT_PATH"

echo ""
fi
}
4 changes: 4 additions & 0 deletions src/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
....

Tests:  4 passed, 4 total
Assertions: 6 passed, 6 total

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
....

Tests:  4 passed, 4 total
Assertions: 6 passed, 6 total

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Tests:  0 total
Assertions: 0 total

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit af5bead

Please sign in to comment.