cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.02k stars 3.18k forks source link

[6.9.0] TypeError: Cannot read property 'split' of undefined #15856

Closed eduardo-fischer-avenue closed 3 years ago

eduardo-fischer-avenue commented 3 years ago

Current behavior

Trying to use Cypress with cypress-multi-reporters, but cypress fail to generate mochawesome report.

Desired behavior

When I execute cypress run i get

TypeError: Cannot read property 'split' of undefined
    at TestRailValidation.countTestSpecFiles (\node_modules\cypress-testrail-reporter\dist\testrail.validation.js:90:30)
    at Runner.<anonymous> (\node_modules\cypress-testrail-reporter\dist\cypress-testrail-reporter.js:107:61)
    at Runner.emit (events.js:327:22)
    at Reporter.emit (\AppData\Local\Cypress\Cache\6.9.1\Cypress\resources\app\packages\server\lib\reporter.js:333:46)
    at Object.onMocha (\AppData\Local\Cypress\Cache\6.9.1\Cypress\resources\app\packages\server\lib\project-base.js:293:26)
    at Socket.<anonymous> (\AppData\Local\Cypress\Cache\6.9.1\Cypress\resources\app\packages\server\lib\socket-base.js:225:40)       
    at Socket.emit (events.js:315:20)
    at Socket.onevent (\AppData\Local\Cypress\Cache\6.9.1\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\socket.js:253:20)
    at Socket._onpacket (\AppData\Local\Cypress\Cache\6.9.1\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\socket.js:216:22)
    at \AppData\Local\Cypress\Cache\6.9.1\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\client.js:205:28
    at processTicksAndRejections (internal/process/task_queues.js:79:11)

Expected to generate mochawesome.json

Test code to reproduce

Cypress.json

{
"reporter": "cypress-multi-reporters",
    "reporterOptions": {
       "configFile": "reporter-config.json"
    }
} 

reporter-config.json ` {

"reporterEnabled": "mochawesome,cypress-testrail-reporter",
"mochawesomeReporterOptions": {
    "reportDir": "mochareports",
    "quiet": true,
    "overwrite": false,
    "html": false,
    "json": true
},
"cypressTestrailReporterReporterOptions": {
    "host": "",
    "username": "",
    "password": "",
    "projectId": ,
    "suiteId": 
}

}`

Versions

eduardo-fischer-avenue commented 3 years ago

Solved. Not a problem with cypress but with mochawesome. cypress-testrail-reporter executes sucessfully but returns an error. Newer versions of mochawesome will not generate a report if executions ends with error. Changed mochawesome version to 1.5.3 and solved.