Skip to content

fix(console): escape a hash in the --output tap description - #1310

Merged
Chemaclass merged 2 commits into
mainfrom
fix/output-tap-escapes-description
Aug 17, 2026
Merged

fix(console): escape a hash in the --output tap description#1310
Chemaclass merged 2 commits into
mainfrom
fix/output-tap-escapes-description

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 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:

not ok 1 - validates input # SKIP unsupported

A consumer parses that as description validates input plus directive 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.

💡 Changes

  • There are two TAP emitters and only one escaped. bashunit::reports::__tap_description was 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-tap file writer; the --output tap stream comes from console/line.sh and never called it
  • Only the description is escaped. The # SKIP, # TODO, # snapshot and # RISKY directives those lines append are bashunit's own and stay literal — verified against a run with genuine skips and incompletes

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
@Chemaclass Chemaclass added the bug Something isn't working label Aug 17, 2026
@Chemaclass Chemaclass self-assigned this Aug 17, 2026
@Chemaclass Chemaclass added the bug Something isn't working label Aug 17, 2026
@Chemaclass
Chemaclass merged commit bbf3bac into main Aug 17, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the fix/output-tap-escapes-description branch August 17, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant