nathanboktae / mocha-phantomjs

:coffee: :ghost: Run client-side mocha tests in the command line through phantomjs
MIT License
954 stars 112 forks source link

Console.log and test reporter are mixed in output #189

Closed nqbao closed 9 years ago

nqbao commented 9 years ago

Sometime when our test scripts print out something, it will be print to stdout and mixed with reporter output. Example as below when i use xunit reporter and the test script print out something.

bootstrap application
init executor id 87d5137c-6db4-5976-7d97-220eca3c210d
<testsuite name="Mocha Tests" tests="9" failures="1" errors="1" skipped="0" timestamp="Tue, 19 May 2015 17:43:01 GMT" time="0.344">
<testcase classname="DrilldownBuidler" name="can parse relationship query" time="0.002"/>
<testcase classname="DrilldownBuidler" name="can parse distribution query" time="0.001"/>
<testcase classname="DrilldownBuidler" name="can generate query hint for distribution query" time="0.001"/>
<testcase classname="DrilldownBuidler" name="can generate query hint for relationship query" time="0.001"/>
<testcase classname="DrilldownBuidler" name="can generate query hint for relationship query with for each" time="0"/>
<testcase classname="Document" name="can create new document" time="0.007"><failure><![CDATA[Author is required [400]
undefined]]></failure></testcase>
<testcase classname="Kernel" name="can run Python code" time="0.064"/>
<testcase classname="Kernel" name="can run R code" time="0.049"/>
<testcase classname="PerformanceTracker" name="can get total duration" time="0.206"/>
</testsuite>

It's hard to consume the reporter output for CI system. I think there are two possible solutions

nathanboktae commented 9 years ago

Please search for issues before filing them. the xunit reporter and console output mixing has been discussed at length in #114 and #161.

Add a flag (--reporter-output) for separately saving the reporter output to a file

We already have that - it's --file but read the issues with xunit first.

nqbao commented 9 years ago

Got it, will do a proper search next time.