Repository navigation
fix(html): don't treat user stdout/stderr attachments as console output - #43558
Open
Ishaan (guptaishaan) wants to merge 1 commit into
Open
Ishaan (guptaishaan) wants to merge 1 commit into
Ishaan (guptaishaan) wants to merge 1 commit into
Conversation
The HTML reporter merged and ANSI-stripped every text/plain attachment named stdout or stderr, assuming a string body. User attachments with those names have a Buffer body or only a path, so stripAnsiEscapes threw and a passing run exited with code 1. Only handle attachments with a string body that way. User attachments now go through the regular attachment path. Fixes microsoft#43555
This branch has not been deployed
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.
Fixes #43555
_serializeAttachments()in the HTML reporter treats everytext/plainattachment namedstdoutorstderras captured console output and runsstripAnsiEscapes(a.body as string). User attachments with those names have a Buffer body (or no body withpath), so the call threwTypeErrorand a passing run exited with code 1.The fix adds
typeof a.body === 'string'to the condition. Console output attachments always have a string body, so only they take the merge and strip branch. User attachments take the normal path.Test: extended
reporter-html.spec.tswith a case attachingstdout(body) andstderr(path). It fails before the fix withstr.replace is not a functionand passes after, in both created and merged report modes.Verified on Linux only. Three git-related tests in
reporter-html.spec.tsfail in my sandbox with and without this change. I ran the new test with a downloaded Chromium in place of thechromechannel, which is not installed here.Thanks to fizzbeom (@fizzbeom) for the report, the repro and the suggested fix.