Skip to content

Conversation

@AndrianBdn
Copy link
Contributor

Summary

Test plan

  • Added 4 new tests covering both fixes (attribute-less elements and bare <testsuite> root)
  • All 71 tests pass
  • npm run check passes (typecheck + lint + format)

Closes #52
Closes #53

- Make $ (attributes) optional on <testsuites> and <testsuite> elements
  so xml2js-parsed files without attributes pass Zod validation (#52)
- Accept bare <testsuite> as root element by wrapping it in <testsuites>
  before validation, removing the need for junit-merge (#53)

Closes #52
Closes #53
@gemini-code-assist
Copy link

Summary of Changes

Hello @AndrianBdn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of the JUnit XML parser by making it more flexible in handling variations of the JUnit XML format. It addresses issues where certain XML structures, specifically those lacking attributes on root elements or using a single <testsuite> as the document root, would fail validation. These changes improve compatibility with various test report generators and simplify the upload process for users.

Highlights

  • Optional JUnit XML Attributes: The Zod validation schema for JUnit XML has been updated to make the attributes ($) optional for both <testsuites> and <testsuite> elements. This allows parsing of JUnit XML files that may not include these attributes, such as those generated by junit-merge.
  • Bare Root Element Support: The parser now accepts a bare <testsuite> element as the root of the XML document. It automatically normalizes this into a <testsuites> structure before validation, removing the need for external tools like junit-merge when uploading per-class report files.
Changelog
  • src/tests/junit-xml-parsing.spec.ts
    • Added new test cases to verify parsing of <testsuites> and <testsuite> elements without attributes.
    • Included tests to confirm correct parsing when a bare <testsuite> is provided as the root element, both with and without attributes.
  • src/utils/result-upload/junitXmlParser.ts
    • Modified the Zod schema to mark the attribute object ($) as optional for <testsuites> and <testsuite> elements.
    • Implemented logic to detect and wrap a bare <testsuite> root element within a <testsuites> object before schema validation.
    • Updated the folder assignment to safely access optional suite.$ properties using optional chaining.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@AndrianBdn AndrianBdn requested a review from satvik007 February 10, 2026 12:51
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces valuable improvements to the JUnit XML parser by making attributes on <testsuites> and <testsuite> optional and by handling reports with a bare <testsuite> as the root element. These changes increase the flexibility of the parser. The addition of new tests to cover these cases is also a great practice.

However, I've identified a critical issue in the implementation for handling a bare <testsuite> root. The current logic incorrectly wraps an already-array-wrapped element, which will lead to parsing failures. My review includes a specific comment and a code suggestion to address this.

@satvik007 satvik007 merged commit 8bbaf6e into main Feb 10, 2026
7 checks passed
@satvik007 satvik007 deleted the fix/junit-xml-flexibility branch February 10, 2026 14:03
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.

junit-upload should accept <testsuite> as root element junit-upload fails on <testsuites> without attributes

2 participants