Fix classic report ignoring category rules with messageRegex/traceRegex - #842
Open
meganemura wants to merge 1 commit into
Open
Fix classic report ignoring category rules with messageRegex/traceRegex#842meganemura wants to merge 1 commit into
meganemura wants to merge 1 commit into
Conversation
categoryMatch() destructured statusMessage/statusTrace, but the caller
in generators.ts builds the result object with message/trace. The
mismatch left statusMessage/statusTrace always undefined, so any
category rule with messageRegex or traceRegex could never match — only
status-only rules (including the built-in Product/Test defects
fallbacks) worked, which silently masked the bug in reports.
message/trace is the correct naming here: ClassicTestResult (built on
core-api's TestResult) carries error info as TestError, whose fields
are {message, trace, actual, expected}, and generators.ts passes
error?.message/error?.trace straight through under those same keys.
statusMessage/statusTrace isn't a typo either — it's the field name
used by the sibling plugin-allure2, whose categories.ts has identical
matching logic but a different data model (Allure2TestResult defines
statusMessage/statusTrace directly). plugin-allure2's caller passes
those same keys, so it isn't affected by this bug.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
meganemura
force-pushed
the
fix-classic-category-regex-matching
branch
from
August 4, 2026 11:30
57f6c99 to
a12b0f1
Compare
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.
Context
categories.jsonrules withmessageRegexortraceRegexnever match anytest result in the classic report — only status-only rules (including the
built-in "Product defects" / "Test defects" fallbacks) do. For example:
{ "name": "Timeout", "matchedStatuses": ["failed"], "messageRegex": ".*timed out.*" }A failing test whose message contains "timed out" still lands under
"Product defects" instead of "Timeout" — with no warning that the rule was
never even evaluated correctly.
Root cause:
generators.tsbuilds the match input as{message, trace, status, flaky}, butcategoryMatchincategories.tsdestructuresstatusMessage/statusTracefrom it. The names never matched, so thosefields were always
undefined, andmatch()treatsundefinedas anon-match whenever a regex is set.
message/traceis the correct naming for this plugin:ClassicTestResultis built on
@allurereport/core-api'sTestResult, whose error info is aTestError({message, trace, actual, expected}), andgenerators.tspasses
error?.message/error?.tracestraight through under those samekeys.
statusMessage/statusTraceisn't a typo — it's the sibling pluginplugin-allure2's field name.plugin-allure2/src/categories.tshasidentical matching logic, but that plugin's own data model
(
Allure2TestResult) definesstatusMessage/statusTracedirectly, andits caller passes those same keys — so that plugin isn't affected by this
bug. The two
categories.tsfiles are close enough to be evidently relatedimplementations; this one ended up carrying the other model's field names.
Fix: destructure
message/traceincategoryMatch, matching boththe caller and the underlying
TestErrortype. Added a regression testusing the exact call shape
generators.tsuses; also fixed 4 existingtests that were unintentionally exercising a call shape the real caller
never uses.
Checklist