Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add file path to xunit reporter #4885

Closed
wants to merge 1 commit into from

Conversation

bmish
Copy link
Contributor

@bmish bmish commented May 17, 2022

Description of the Change

Expose test file path for each test case in the xunit reporter.

<testsuite name="Mocha Tests" tests="2" failures="0" errors="0" skipped="0" timestamp="Tue, 17 May 2022 21:10:34 GMT" time="0.001">
<testcase classname="Array #indexOf()" name="should return -1 when the value is not present" file="/path/to/test/array.js" time="0"/>
<testcase classname="Set #has()" name="should return false when the value is not present" file="/path/to/test/set.js" time="0"/>
</testsuite>

Alternate Designs

Why should this be in core?

The test file path was already added to other reporters in this PR:

It seems the file path can be added to each reporter as needed.

Benefits

  • Can be easier to find test file from file path instead of just test name, especially when overlapping/similar/identical test names are present, or in a large codebase
  • In particular, it can be easier for automated tooling to find the test file from the file path as opposed to the test name when performing test analysis or other scripting

Possible Drawbacks

  • Greater size / noise of output for people who don't need the file path
  • Let me know if there's any other reason not to do this

Applicable issues

None.

This should be part of a minor release as an enhancement.

@github-actions
Copy link

This PR hasn't had any recent activity, and I'm labeling it stale. Remove the label or comment or this PR will be closed in 14 days. Thanks for contributing to Mocha!

@github-actions github-actions bot added the stale this has been inactive for a while... label Sep 16, 2022
@github-actions github-actions bot closed this Sep 30, 2022
@villelahdenvuo
Copy link
Contributor

I would love to have this for splitting tests on the CI!

@bmish
Copy link
Contributor Author

bmish commented May 15, 2023

@villelahdenvuo I just reopened the PR as #4985. Please comment or upvote the PR to express interest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale this has been inactive for a while...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants