fix(console): escape a hash in the --output tap description - #1310
Merged
Conversation
TAP 13 reads an unescaped # on a test line as the start of a directive, so a title holding one hands the consumer a directive bashunit never meant. A failing test titled '... # SKIP ...' came out as not ok 1 - validates input # SKIP unsupported and a not-ok carrying a SKIP directive is not a failure, so it left CI silently. # TODO does the same to a passing test. There are two TAP emitters and only one escaped: __tap_description was written for this in #1119 and is used by the --report-tap file writer, while the --output tap stream comes from console/line.sh, which never called it. Only the description is escaped -- the # SKIP, # TODO, # snapshot and # RISKY directives those lines append are bashunit's own. Closes #1309
…s-description # Conflicts: # CHANGELOG.md
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 #1309
TAP 13 reads an unescaped
#on a test line as the start of a directive. A failing test whose title holds one came out as:A consumer parses that as description
validates inputplus directiveSKIP unsupported— and anot okcarrying a SKIP directive is not a failure, so it left CI silently.# TODOdoes the same to a passing test.💡 Changes
bashunit::reports::__tap_descriptionwas written for exactly this in TAP: a '#' in a test name is read as a directive, so a passing test reports as skipped #1119 (its comment names the case, and it carries the[#]workaround for Bash 3.0 reading a bare#after//as anchor-to-start) and is used by the--report-tapfile writer; the--output tapstream comes fromconsole/line.shand never called it# SKIP,# TODO,# snapshotand# RISKYdirectives those lines append are bashunit's own and stay literal — verified against a run with genuine skips and incompletes