cypress-io/cypress

mocha-junit-reporter system-out and system-err doesn't work

zainfathoni opened this issue · 6 comments

Current behavior:

I have this line in spec.js file.

this.test.consoleOutputs = ['consoleOutputs test']

While using junit reporter, which is actually using mocha-junit-reporter behind the scene, it generated this results/my-test-output.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="0.025" tests="1" failures="0">
  <testsuite name="Root Suite" timestamp="2019-05-19T20:48:15" tests="0" failures="0" time="0">
  </testsuite>
  <testsuite name="page" timestamp="2019-05-19T20:48:15" tests="1" failures="0" time="0.025">
    <testcase name="page works" time="0.025" classname="works">
    </testcase>
  </testsuite>
</testsuites>

Desired behavior:

As described here, mocha-junit-reporter should have generated <system-out> into the XML result file. i.e.

<system-out>consoleOutputs test</system-out>

This is the expected complete file, taken from the result file generated by mocha test.
results/mocha-test-output.xml

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="0" tests="1" failures="0">
  <testsuite name="Root Suite" timestamp="2019-05-19T21:13:41" tests="0" failures="0" time="0">
  </testsuite>
  <testsuite name="page" timestamp="2019-05-19T21:13:41" tests="1" file="/Users/nvuser/Code/zainfathoni/cypress-test-tiny/cypress/integration/spec.js" failures="0" time="0">
    <testcase name="page works" time="0" classname="works">
      <system-out>consoleOutputs test</system-out>
    </testcase>
  </testsuite>
</testsuites>

Steps to reproduce: (app code and test code)

  1. Clone this repo
  2. Run npm install
  3. Run npm run cypress:run to get the current behavior from Cypress test
  4. Run npm run mocha:test to get the desired behavior from Mocha test

Versions

  • Cypress: 3.3.0
  • mocha-junit-reporter: 1.22.0

Is this issue going to be investigated?
I stumbled upon the same problem.

We're having the same issue using cypress 9.5.4 which appears to include mocha-junit-reporter 2.0.0. This also seems to affect attachments.

Any update?

@EmreCihanbeyoglu You commented on a really old issue. Can you provide any details in your case? A simple reproduction would be most helpful. Also, please make sure you are using a recent version of Cypress.

Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen.

still the same problem. Used the basic mocha-junit-reporter reporter and reporterOptions.

Properties are being appended.

https://www.npmjs.com/package/mocha-junit-reporter#append-properties-to-testsuite

But this is not working

this.test.consoleOutputs = ['consoleOutputs test']