Cypress: Does not work well with mocha-multi-reporters

Created on 19 Oct 2017  Â·  9Comments  Â·  Source: cypress-io/cypress

  • Operating System: MacOS Sierra 10.12.6
  • Cypress Version: 1.0.2

Is this a Feature or Bug?

Bug

Current behavior:

Cypress crashes when mocha-multi-reporters is installed locally.
Cypress cannot load the reporter when it is installed globally.

Desired behavior:

Cypress can use mocha-multi-reporters as intended.

How to reproduce:

  • config.json:
{
  "reporterEnabled": "spec, mocha-junit-reporter",
  "mochaJunitReporterReporterOptions": {
    "mochaFile": "multiple-results/results.xml"
  }
}
  • cypress.json
{
  "reporter": "mocha-multi-reporters",
  "reporterOptions": {
    "reporterEnabled": "spec, mocha-junit-reporter",
    "mochaJunitReporterReporterOptions": {
        "mochaFile": "cypress/reports/junit.xml"
    }
  }
}

Additional Info (images, stack traces, etc)

See https://github.com/cypress-io/cypress-example-docker-circle/issues/6

needs investigating

Most helpful comment

I have the same problem when using lerna with yarn workspace option

All 9 comments

In the https://github.com/cypress-io/cypress-example-docker-circle we have Cypress v1.0.2 with working multi-reporters output, what is the difference with your failing case?

When running tests from that repo, I get the same result when installed the reporter globally. But it seems to work with the reporter installed locally. I will do some extra tests to find out the differences between that project and my project where Cypress seems to crash.

I believe this has to do with the way we resolve the path. @bahmutov What he's saying is that when the reporter is installed locally it works because we resolve the node_modules relative to the projectRoot. However when installed globally this ends up being stored in a completely different place. We likely need to add the same lookup machinery that node does under the hood, instead of using manual path resolutions.

Yeah, edge case that we are not testing against

Sent from my iPhone

On Oct 19, 2017, at 13:16, Brian Mann notifications@github.com wrote:

I believe this has to do with the way we resolve the path. @bahmutov What he's saying is that when the reporter is installed locally it works because we resolve the node_modules relative to the projectRoot. However when installed globally this ends up being stored in a completely different place. We likely need to add the same lookup machinery that node does under the hood, instead of using manual path resolutions.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

In the meantime, I figured out that it only crashes on a specific (failing) test. (When reporters are installed locally)

That's awesome - if you can pinpoint to specific failing test and have reproducible crash we can play with - we can fix it.

Sent from my iPhone

On Oct 20, 2017, at 08:32, Thomas Casteleyn notifications@github.com wrote:

In the meantime, I figured out that it only crashes on a specific (failing) test. (When reporters are installed locally)

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

It goes well when testing:

cy.wait('@BuyRecharge').its('response.body')

Which is logical as this is not a failing test, but then when running:

cy.wait('@BuyRecharge').its('response.body').should('contain', '|pageRedirect|')

The test fails in this case (as pageRedirect is not present in the response) and lets Cypress crash.

The first line in the stack trace goes to this file mocha/lib/reporters/base.js:227 saying that test.titlePath is not a function. Which seems logically that it only happens when the test is in failures as this code is part of a function Base.list(failures)

While looking into that, I picked a very simple test with a cy.get and a tag that does not exist and the same kind of crash with same stack trace happens. See this project to reproduce: webtest.zip

Any feedback?

I have the same problem when using lerna with yarn workspace option

Was this page helpful?
0 / 5 - 0 ratings

Related issues

weskor picture weskor  Â·  3Comments

egucciar picture egucciar  Â·  3Comments

brian-mann picture brian-mann  Â·  3Comments

zbigniewkalinowski picture zbigniewkalinowski  Â·  3Comments

verheyenkoen picture verheyenkoen  Â·  3Comments