JUnit report generation with ReTest

Anyone generating JUnit XML reports from tests? Tried the mocha one (I’m using Retest), but it doesn’t generate anything.

If I uninstall 9 and install 6, I see the report, but no tests in there. wat.

I’m using mocha-jenkins-reporter, which generates JUnit XML (certainly to the level that Jenkins expects).

1 Like

Thanks a ton, I’ll check this out tomorrow morning and try it!

1 Like

This was a bust. I added logs to every function and none were called. I did see it successfully registered via DEBUG=*, but that’s it. Maybe my Mocha is too new and plugin architecture changed?

"mocha": "^9.2.0",
"mocha-jenkins-reporter": "^0.4.7",

Mocha 6 will output a report, but it only runs:

*** jenkins::runner start
*** jenkins::runner end
*** jenkins::endSuite

And the XML is blank. I’m wondering if it’s because I’m using ReTest and like it has no suites? I don’t have a describe anywhere like I do in Mocha JS tests, just test and testAsync… not sure if that’s the problem though, grasping at straws here.

Sorry for not following up earlier. I’m using the same versions as you (mocha 9.2.0, reporter 0.4.7) and it works very well for me. The command I test with is:

JUNIT_REPORT_PATH=scratch/report.xml mocha --forbid-only --forbid-pending -R mocha-jenkins-reporter

Which then creates the report.xml file in my scratch folder and Jenkins imports it quite happily.