Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the output adding a space between each test file #385

Merged
merged 4 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading