Skip to content

Add junit-xml output format#3453

Open
nitishagar wants to merge 1 commit into
facebook:mainfrom
nitishagar:nitishagar/issue-3389-junitxml-report
Open

Add junit-xml output format#3453
nitishagar wants to merge 1 commit into
facebook:mainfrom
nitishagar:nitishagar/issue-3389-junitxml-report

Conversation

@nitishagar
Copy link
Copy Markdown

Summary

  • Adds OutputFormat::JunitXml (--output-format junit-xml, or output-format = "junit-xml" in pyrefly.toml) emitting a JUnit-XML <testsuites> document.
  • Mirrors the existing Json / Github writer pattern in pyrefly/lib/commands/check.rs. No new dependencies — hand-rolled XML escaping (attributes and CDATA, including ]]> splitting).
  • One <testcase> per error, with classname carrying the file path, name carrying error_kind:Lline, plus file and line attributes for CI dashboards that bucket per file.
  • Severity mapping: error and warn produce <failure> entries (warnings rendered as type="warning"); info and ignore are dropped, matching the existing JSON writer.

Fixes #3389

Test plan

  • cargo test -p pyrefly --lib — 5157/5157 passing locally (includes the two new tests for structure and escaping).
  • cargo test -p pyrefly_config test_output_format_config_parsing — 1/1.
  • New scrut block in test/errors.md covering --output-format junit-xml.
  • CI green.

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 18, 2026

Hi @nitishagar!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 19, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@samwgoldman samwgoldman self-assigned this May 19, 2026
@samwgoldman
Copy link
Copy Markdown
Member

Hey, can you rebase this change? I'm having trouble importing it because of the merge conflict in Cargo.lock. Thanks!

Adds OutputFormat::JunitXml producing a JUnit-XML <testsuites> document so
pyrefly's report can be consumed by CI dashboards. Hand-rolled writer with
proper attribute and CDATA escaping; no new deps.

Fixes facebook#3389
@nitishagar nitishagar force-pushed the nitishagar/issue-3389-junitxml-report branch from d4d08e7 to e031e78 Compare May 20, 2026 09:41
@github-actions github-actions Bot added size/l and removed size/l labels May 20, 2026
@nitishagar
Copy link
Copy Markdown
Author

nitishagar commented May 20, 2026

@samwgoldman Rebased onto latest main and resolved the Cargo.lock conflict, should be importable now. Thanks!

@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 22, 2026

@samwgoldman has imported this pull request. If you are a Meta employee, you can view this in D105751390.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

junitxml report format support

2 participants