Skip to content

reporters: rename xunit to junit, deprecate old xunit name#5875

Open
mostafaNazari702 wants to merge 1 commit into
mochajs:mainfrom
mostafaNazari702:reporters/rename-xunit-to-junit
Open

reporters: rename xunit to junit, deprecate old xunit name#5875
mostafaNazari702 wants to merge 1 commit into
mochajs:mainfrom
mostafaNazari702:reporters/rename-xunit-to-junit

Conversation

@mostafaNazari702
Copy link
Copy Markdown
Contributor

PR Checklist

Overview

The xunit reporter has always emitted JUnit XML (<testsuite>/<testcase>) rather than actual xUnit.net XML. This renames the reporter to junit and turns xunit into a deprecated wrapper that emits a DeprecationWarning via process.emitWarning (suppresible with --no-warnings).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

👋 Hi @mostafaNazari702, thanks for the pull request! A scan flagged a concern with it. Could you please take a look?

[pr-task-completion] This PR's body is missing [x] checks on the following tasks from the PR template.

Repositories often provide a set of tasks that pull request authors are expected to complete. Those tasks should be marked as completed with a [x] in the pull request description. Please complete those tasks and mark the checks as [x] completed.

🗺️ This message was posted automatically by OctoGuide: a bot for GitHub repository best practices.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.72%. Comparing base (e15bbda) to head (e81fcfa).
⚠️ Report is 26 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5875      +/-   ##
==========================================
+ Coverage   89.71%   89.72%   +0.01%     
==========================================
  Files          64       65       +1     
  Lines        4695     4703       +8     
  Branches      978      978              
==========================================
+ Hits         4212     4220       +8     
  Misses        483      483              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The xunit reporter has always emitted JUnit-format XML (testsuite/testcase
elements), not actual xUnit.net format. Fixes mochajs#4758.

- adds a new junit reporter with all the same logic
- turns xunit into a thin deprecation wrapper that extends JUnit
- the deprecation goes through process.emitWarning so its suppressable
  with --no-warnings and wont spam CI stderr like console.warn would
- updated docs and tests accordingly
@mostafaNazari702 mostafaNazari702 force-pushed the reporters/rename-xunit-to-junit branch from 8f28c92 to e81fcfa Compare April 8, 2026 16:58
@mostafaNazari702
Copy link
Copy Markdown
Contributor Author

Codecov Report

✅ All modified and coverable lines are covered by tests. ✅ Project coverage is 89.72%. Comparing base (e15bbda) to head (e81fcfa).
Additional details and impacted files

☔ View full report in Codecov by Sentry. 📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:

This concerns me....

@@ -1,11 +1,22 @@
---
description: The XUnit test reporter for Mocha.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we'll probably redirect this page instead of adding a deprecation notice, it's just the doc site so "breaking changes" like a redirect are not actually a concern :)

@mark-wiemer mark-wiemer added the semver-major implementation requires increase of "major" version number; "breaking changes" label Apr 15, 2026
@mark-wiemer
Copy link
Copy Markdown
Member

Don't have energy to fully review right now, sorry, hopefully soon though :) we are still focusing on v12 and then I will set up a v13 branch for this to merge into :)

Copy link
Copy Markdown
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

LGTM! A bit unfortunate we'll have to wait to merge this for a while (breaking change for v13).

expectedWrite += str;
});

//3 tests, no failures (i.e tests that could not run), and 2 errors
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Nit] Teeny nit, a few comments changed in the move. Did an AI agent have a hiccup or something? 🙂

Suggested change
//3 tests, no failures (i.e tests that could not run), and 2 errors
// 3 tests, no failures (i.e tests that could not run), and 2 errors

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That was actually on me, i am using a different IDE on Arch Linux, and i sometimes run into graphics/rendering quirks (GPU-related as i have what is not "recommended" for ArchLinux) that make spacing look off. I removed what I thought was an extra space, but checking the PR now i see ( through my phone ) it was correct originally.

And regarding the AI use, I can see why it might come across that way from the templates/formattings on almost all my PRs/commits, but I’m not using AI to generate the code itself, just for comment and template generations and explaining my autistic thoughts 🙂

@mark-wiemer mark-wiemer added the status: blocked Waiting for something else to be resolved label Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-major implementation requires increase of "major" version number; "breaking changes" status: blocked Waiting for something else to be resolved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug: xUnit XML format is actually JUnit's schema

4 participants