fix(reporter): surface JSON.stringify failures in json reporter instead of silently succeeding#41620
Open
Git-Raini wants to merge 1 commit into
Open
fix(reporter): surface JSON.stringify failures in json reporter instead of silently succeeding#41620Git-Raini wants to merge 1 commit into
Git-Raini wants to merge 1 commit into
Conversation
…ad of silently succeeding Wrap JSON.stringify in outputReport() so a RangeError (report too large for a JS string) is rethrown as a clear, actionable error instead of propagating a cryptic V8 error. The existing reporter-error mechanism (Multiplexer.hasReporterErrors, added in microsoft#41307) already fails the run/ merge command with a non-zero exit code once onEnd throws, so this makes the json reporter benefit from that instead of producing a missing/empty report file with exit code 0. Fixes: microsoft#40983
yury-s
reviewed
Jul 7, 2026
| // string would exceed the JS engine's max string length (e.g. for very large merged | ||
| // reports). Surface this as a real, actionable error instead of silently producing | ||
| // a missing/empty report file - the caller (reporter/merge command) will fail the run. | ||
| throw new Error(`Failed to generate JSON report: the report is too large to serialize (${e instanceof Error ? e.message : String(e)}). Consider splitting the run into smaller shards or using a different reporter.`); |
Member
There was a problem hiding this comment.
Can we match actual error that we know is caused by a too large report and wrap the error only in that case or rephrase message. Also remove the comment.
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 #40983