mirror of
https://github.com/sstephenson/bats.git
synced 2026-02-25 17:28:11 +01:00
Print the outermost, not innermost, failed command
The outermost command—i.e. the line that failed inside the test case function itself—is more likely to be meaningful at a glance than the innermost command, which might be e.g. the implementation of a helper assertion.
This commit is contained in:
@@ -253,7 +253,7 @@ bats_exit_trap() {
|
||||
if [ -z "$BATS_TEST_COMPLETED" ] || [ -z "$BATS_TEARDOWN_COMPLETED" ]; then
|
||||
echo "not ok $BATS_TEST_NUMBER $BATS_TEST_DESCRIPTION" >&3
|
||||
bats_print_stack_trace "${BATS_ERROR_STACK_TRACE[@]}" >&3
|
||||
bats_print_failed_command "${BATS_ERROR_STACK_TRACE[0]}" "$BATS_ERROR_STATUS" >&3
|
||||
bats_print_failed_command "${BATS_ERROR_STACK_TRACE[${#BATS_ERROR_STACK_TRACE[@]}-1]}" "$BATS_ERROR_STATUS" >&3
|
||||
sed -e "s/^/# /" < "$BATS_OUT" >&3
|
||||
status=1
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user