Skip to content

fix: pass junit-to-ctrf integration options to the converter - #352

Merged
Ma11hewThomas merged 1 commit into
ctrf-io:mainfrom
cschmertz:fix/junit-to-ctrf-options
Nov 28, 2026
Merged

Ma11hewThomas merged 1 commit into
ctrf-io:mainfrom
cschmertz:fix/junit-to-ctrf-options

Conversation

@cschmertz

Copy link
Copy Markdown
Contributor

Closes #207 (and #200, which was closed in favor of it).

The junit-to-ctrf integration's options never reached the converter. With the config from #207, output wrote no file, toolname was ignored, and env values like appName were missing from the report, with buildUrl taken from the GitHub run instead. "enabled": false didn't turn the conversion off either.

  • prepareReport now maps output, toolname, useSuiteName and env to junit-to-ctrf's outputPath, toolName, useSuiteName and envProps, the last as key=value strings, which is the format it parses.
  • enrichCurrentReportWithRunDetails already fills only blank fields, so once env gets through, the given buildUrl is kept and the GitHub context fills in the rest. No change was needed there.
  • "enabled": false now skips the conversion. A config with no enabled still converts, as it does today: otherwise those workflows would quietly stop reporting (the XML is read as CTRF and the action exits with a warning). Happy to require "enabled": true like the other integrations instead.

Testing:

  • New __tests__/ctrf/junit-integration.test.ts, the first tests for the JUnit path, using the existing junit-to-ctrf mock. 3 of the 5 fail on main (options, default options, enabled: false). The other 2 cover behavior that stays the same: env values survive enrichment, and a config with no enabled still converts.
  • npm test passes on Node 24 and 26 (364 passed, 2 skipped). build:check, lint:check and format:check pass, and lint shows the same 15 warnings as main.
  • I ran the built action on ctrf-reports/test-junit.xml with the config from Bug: Integration with junit-to-ctrf does not use arguments #207. On main there's no output file and buildUrl comes from the run. With this change the output file is written with toolname as the tool name, and the final report keeps appName and the given buildUrl.
  • dist/ is rebuilt with npm run package on Node 26 and differs from main's build only by this change.
  • CHANGELOG entry under Unreleased.

Written with Claude Code; I reviewed the changes and ran the full suite locally.

The junit-to-ctrf integration's options (output, toolname, useSuiteName,
env) were never passed to convertJUnitToCTRFReport, and the conversion ran
even with "enabled": false. Map the options to the converter's, passing env
as key=value strings, and skip the conversion when enabled is false.

Closes #207
@Ma11hewThomas
Ma11hewThomas merged commit b7baedf into ctrf-io:main Nov 28, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Integration with junit-to-ctrf does not use arguments

2 participants