meteor-mocha
meteor-mocha copied to clipboard
Bugfix/xunit browser output
This is a fix for the XUNIT reporter output from the client. I was experiencing issues with this when running client tests in headless mode via Puppeteer.
Here's a reproduction repository: https://github.com/imajus/meteor-browser-tests-issue/
Expected to get XML in test-results/client.xml
but getting the following contents:
In the test groupIn the test case<testsuite name="Mocha Tests" tests="1" failures="0" errors="1" skipped="0" timestamp="Fri, 20 Sep 2024 05:34:25 GMT" time="0.003">
<testcase classname="Example" name="test" time="0.001"><failure>undefined undefined undefined
AssertionError: undefined undefined undefined
at Context.<anonymous> (app/app.js?hash=818e846856c24f4b042929071138d0f3cfb8a773:20:12)
at callFn (packages/meteortesting_mocha-core.js?hash=dd1ee602c0eabe4198d6106e7f5734b6963d105c:13223:23)
at Test$4.Runnable$3.run (packages/meteortesting_mocha-core.js?hash=dd1ee602c0eabe4198d6106e7f5734b6963d105c:13211:7)
at Runner.runTest (packages/meteortesting_mocha-core.js?hash=dd1ee602c0eabe4198d6106e7f5734b6963d105c:14756:12)
at http://localhost:3000/packages/meteortesting_mocha-core.js?hash=dd1ee602c0eabe4198d6106e7f5734b6963d105c:14879:14
at next (packages/meteortesting_mocha-core.js?hash=dd1ee602c0eabe4198d6106e7f5734b6963d105c:14671:16)
at http://localhost:3000/packages/meteortesting_mocha-core.js?hash=dd1ee602c0eabe4198d6106e7f5734b6963d105c:14681:9
at next (packages/meteortesting_mocha-core.js?hash=dd1ee602c0eabe4198d6106e7f5734b6963d105c:14564:16)
at http://localhost:3000/packages/meteortesting_mocha-core.js?hash=dd1ee602c0eabe4198d6106e7f5734b6963d105c:14649:7
at timeslice (packages/meteortesting_mocha-core.js?hash=dd1ee602c0eabe4198d6106e7f5734b6963d105c:20603:29)</failure></testcase>
</testsuite>
As part of this PR there's also a refactoring which makes is easier to handle the MOCHA_REPORTER
environment variable value in the source code.