Search code examples
cypressmochawesome

TypeError: Cannot set properties of undefined (setting 'err')


I'm working on generating mochawesome report by executing my cypress Test

My configuration are like that:

Cypress.json

{
  "defaultCommandTimeout": 100000,
  "reporter": "cypress-mochawesome-reporter",
  "reporterOptions": {
    "reportDir": "cypress/reports",
    "charts": true,
    "reportPageTitle": "Esesame Autoamtion report",
    "reportFilename": "CATS-[status]-[datetime]-report",
    "timestamp": "yyyy-mm-dd_HH-MM-ss"
  }
}

package.json

"devDependencies": {
    "cypress": "^9.5.3",
    "cypress-mochawesome-reporter": "^3.2.0",
    "mocha": "^10.0.0",
    "mochawesome-merge": "^4.2.1",
    "mochawesome-report-generator": "^6.2.0"
  },

It works when I had only 3 test to excute, now I just add the forth test and I get this error at the end of my test excution / generating reports

[mochawesome] Report JSON saved to /builds/project/project/cypress/reports/.jsons/CATS-fail-2022-07-21_13-47-41-report.json
TypeError: **Cannot set properties of undefined (setting 'err')**
    at Reporter.mergeErr (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/reporter.js:192:12)
    at Reporter.parseArgs (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/reporter.js:377:18)
    at Reporter.emit (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/reporter.js:359:17)
    at ProjectBase.<anonymous> (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/project-base.js:461:34)
    at Generator.next (<anonymous>:null:null)
    at /root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>:null:null)
    at __awaiter (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/node_modules/tslib/tslib.js:113:16)
    at Object.onMocha (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/project-base.js:454:65)
    at Socket.<anonymous> (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/socket-base.js:213:40)
    at Socket.emit (node:events:394:28)
    at Socket.emitUntyped (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/typed-events.js:69:22)
    at /root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:428:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
**TypeError: Cannot set properties of undefined (setting 'err')**
    at Reporter.mergeErr (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/reporter.js:192:12)
    at Reporter.parseArgs (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/reporter.js:377:18)
    at Reporter.emit (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/reporter.js:359:17)
    at ProjectBase.<anonymous> (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/project-base.js:461:34)
    at Generator.next (<anonymous>:null:null)
    at /root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>:null:null)
    at __awaiter (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/node_modules/tslib/tslib.js:113:16)
    at Object.onMocha (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/project-base.js:454:65)
    at Socket.<anonymous> (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/socket-base.js:213:40)
    at Socket.emit (node:events:394:28)
    at Socket.emitUntyped (/root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/typed-events.js:69:22)
    at /root/.cache/Cypress/9.5.3/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:428:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

Solution

  • Find that a test case not executed perfectly at the end . when mochawesome tries to generate report , it find that this one is not accomplished , so the error shows.

    It allows me to migrate to a newer version such is : 10.3.0