Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lucasbernardestoradex
Copy link
Contributor

@lucasbernardestoradex lucasbernardestoradex commented Nov 26, 2025

@lucasbernardestoradex lucasbernardestoradex requested a review from a team as a code owner November 26, 2025 16:49
Previously, trace output (FD3) from skipped tests were not explicitly handled
in 'bats_tap_stream_comment()' function of 'bats-format-junit', so their trace
output fell into the catch-all '*' case:

  bats_tap_stream_comment() { # <comment text without leading '# '> <scope>
    local comment="$1" scope="$2"
    case "$scope" in
    begin)
      # everything that happens between begin and [not] ok is FD3 output from the test
      log_system_out "$comment"
      ;;
    ok)
      # non failed tests can produce FD3 output
      log_system_out "$comment"
      ;;
    *)
      # everything else is considered error output
      log "$1"
      ;;
    esac
  }

As a result, when using '--trace' flag, skipped tests output were incorrectly
reported as failures in the JUnit report because of this condition present in
'bats-format-junit':

  if [[ -n "$_buffer_log" || "$test_result_state" == not_ok ]]; then
    printf "        <failure type=\"failure\">%s</failure>\n" "$(xml_escape "${_buffer_log}")"
  fi

This change explicitly adds 'skipped' to the scope handled alongside 'ok',
so trace output for skipped tests goes to 'log_system_out "$comment"'. Skipped
tests are now correctly reported and not marked as failures.

Signed-off-by: Lucas Bernardes <[email protected]>
Signed-off-by: Lucas Bernardes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant