adamgruber / mochawesome

A Gorgeous HTML/CSS Reporter for Mocha.js

Home Page:https://gitter.im/mochawesome/general

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with mochawesome: TypeError: Cannot read properties of undefined (reading 'length')

quad5 opened this issue · comments

commented

Describe the bug
A clear and concise description of what the bug is.

I am using Cypress, and I am not sure whose bug this belongs to. What is happening is that it seems like html file isn't generated when I am running more than 1 spec file.

Code Reproduce
Link to repo where the issue can reliably be reproduced:

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

image

image

Environment (please complete the following information):

  • Platform
  • mochawesome version
    "cypress-mochawesome-reporter": "3.0.0",
    "mochawesome": "7.1.2"
  • mocha (or other test library) version
    mocha: 9.2.2
  • Node version
    Node: 16.5.0

Additional context
Add any other context about the problem here.

Please provide steps to reproduce.

Ran into this issue myself. The problem was a utility file in the cypress/integration folder that had no tests in it.

Ran into this issue myself. The problem was a utility file in the cypress/integration folder that had no tests in it.

@jaltmanQ - I'm seeing a similar error and I do not have a cypress/integration folder present at all.

@adamgruber - This problem seems to be occurring not just with multiple spec files - but instead (for me at least), this happens when tests may not be run even though Cypress sees them. I'll try to explain concisely. In my project I have setup spec files to have tags and when Cypress is run, I specify 1 or more tags. If multiple spec files exist AND the tags match all spec files present, then the reports are generated without any issue. Even if some files don't actually run tests. I verified that by including a spec file with 1 test, and marked it as it.skip().

The more specific problem, when I see this error, is when there are multiple spec files present but the used tag means that Cypress will skip over 1 or more. This is the case when the error occurs for me. This is new behaviour - but I'm not certain how recent as I've unfortunately just upgraded from versions I was using a few months ago.

I can say with some conviction that before making upgrades to several packages recently - cypress-mochawesome-reporter included - that this problem did not exist and no errors were generated when spec files were present that were skipped over.

Released 7.1.3 to address this issue.