fix(runner): keep the tear_down blank line out of machine output - #1298
Merged
Conversation
hooks.sh prints this blank line from two sibling paths. The early-return one guards on is_json_output_enabled and is_junit_output_enabled; the path taken when tear_down_after_script exists and ran omitted both, so the line landed on stdout ahead of the document. XML wants its declaration at byte 0, so an ordinary tear_down_after_script -- the hook did not have to fail -- made --output junit unparseable. JSON carried the same stray byte but tolerates leading whitespace. --parallel skipped the line entirely, so the two modes disagreed. tap stays excluded on purpose: it streams line by line. Closes #1297
…tear-down-after-script # Conflicts: # CHANGELOG.md # tests/acceptance/bashunit_output_stdout_test.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 Background
Related #1297
--outputpromises stdout is the document. A file with atear_down_after_scriptwrote a blank line there first, so the XML declaration was no longer at byte 0:The hook did not have to fail — an ordinary
tear_down_after_script() { :; }was enough, which makes this ordinary usage rather than an edge case.--parallelskipped the line entirely, so the modes also disagreed.💡 Changes
tear_down_after_scriptnow carries the same machine-format guards its sibling path already had.tapstays excluded on purpose: it streams line by line, so a blank line between files is valid there and its snapshots record it--output jsoncarried the same stray byte and only parsed because JSON tolerates leading whitespace; it is gone from that stream too🔍 How it was found
Extending the sweep from #1295 to assert the document contract rather than the console summary: every pathological fixture × {sequential, parallel} × {json, junit}, each one actually parsed. Two further unrelated cases from that table are filed separately.