Open imajus opened 2 months ago
FYI the solution is based on the fact that Xunit output can only write to console
or process.stdout
(if it's present) in a browser. To my knowledge, the process.stdout
option is only available for PhantomJS driver.
So the only way to get the Xunit reporter output is to somehow "scrap" it from the console output. Given that it's garanteed to be XML tags, I've implemented a hacky, yet seemingly reliable solution to filter out all non-XML-like lines from the browser's console log when piping the output to a file. Additionally, the filtered out console log lines aren't just thrown away silently, but are instead logged in the server execution log.
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: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.