TypeError: Cannot read properties of undefined (reading 'length')
See original GitHub issueCurrent behavior
When running mochawesome as reporter, it shows error
[mochawesome] Problem with mochawesome: TypeError: Cannot read properties of undefined (reading 'length')
at Runner.<anonymous> (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome\src\mochawesome.js:164:30)
at Runner.emit (node:events:406:35)
at Reporter.emit (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\reporter.js:362:46)
at ProjectBase.<anonymous> (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\project-base.js:460:34)
at Generator.next (<anonymous>:null:null)
at C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\node_modules\tslib\tslib.js:117:75
at new Promise (<anonymous>:null:null)
at __awaiter (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\node_modules\tslib\tslib.js:113:16)
at Object.onMocha (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\project-base.js:453:65)
at Socket.<anonymous> (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\socket-base.js:213:40)
at Socket.emit (node:events:394:28)
at Socket.emitUntyped (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\typed-events.js:69:22)
at C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\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 read properties of undefined (reading 'results')
at getFilename (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome-report-generator\lib\main.js:132:47)
at getOptions (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome-report-generator\lib\main.js:150:18)
at prepare (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome-report-generator\lib\main.js:269:23)
at Object.create (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome-report-generator\lib\main.js:303:18)
at done (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome\src\mochawesome.js:36:6)
at Mochawesome.done (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome\src\mochawesome.js:103:5)
at C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\cypress-multi-reporters\lib\MultiReporters.js:136:18
at Array.forEach (<anonymous>:null:null)
at MultiReporters.done (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\cypress-multi-reporters\lib\MultiReporters.js:135:30)
at C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\reporter.js:430:30
at Promise.cancellationExecute [as _execute] (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\debuggability.js:406:9)
at Promise._resolveFromExecutor (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:518:18)
at new Promise (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:103:10)
at Reporter.end (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\reporter.js:429:14)
at ProjectBase.<anonymous> (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\project-base.js:463:70)
at Generator.next (<anonymous>:null:null)
at C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\node_modules\tslib\tslib.js:117:75
at new Promise (<anonymous>:null:null)
at __awaiter (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\node_modules\tslib\tslib.js:113:16)
at Object.onMocha (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\project-base.js:453:65)
at Socket.<anonymous> (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\socket-base.js:213:40)
at Socket.emit (node:events:394:28)
at Socket.emitUntyped (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\typed-events.js:69:22)
at C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\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 read properties of undefined (reading 'results')
at getFilename (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome-report-generator\lib\main.js:132:47)
at getOptions (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome-report-generator\lib\main.js:150:18)
at prepare (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome-report-generator\lib\main.js:269:23)
at Object.create (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome-report-generator\lib\main.js:303:18)
at done (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome\src\mochawesome.js:36:6)
at Mochawesome.done (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\mochawesome\src\mochawesome.js:103:5)
at C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\cypress-multi-reporters\lib\MultiReporters.js:136:18
at Array.forEach (<anonymous>:null:null)
at MultiReporters.done (C:\Users\admin\OneDrive\Documents\Automation\PlatformOneQA\node_modules\cypress-multi-reporters\lib\MultiReporters.js:135:30)
at C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\reporter.js:430:30
at Promise.cancellationExecute [as _execute] (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\debuggability.js:406:9)
at Promise._resolveFromExecutor (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:518:18)
at new Promise (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:103:10)
at Reporter.end (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\reporter.js:429:14)
at ProjectBase.<anonymous> (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\project-base.js:463:70)
at Generator.next (<anonymous>:null:null)
at C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\node_modules\tslib\tslib.js:117:75
at new Promise (<anonymous>:null:null)
at __awaiter (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\node_modules\tslib\tslib.js:113:16)
at Object.onMocha (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\project-base.js:453:65)
at Socket.<anonymous> (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\server\lib\socket-base.js:213:40)
at Socket.emit (node:events:394:28)
at Socket.emitUntyped (C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\typed-events.js:69:22)
at C:\Users\admin\AppData\Local\Cypress\Cache\9.5.1\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\socket.js:428:39
at processTicksAndRejections (node:internal/process/task_queues:78:11)
Desired behavior
Should run and generate report
Test code to reproduce
"devDependencies": {
"cypress": "^9.5.1",
"cypress-multi-reporters": "^1.5.0",
"dev-cli": "^0.0.0",
"junit-merge": "^2.0.0",
"mocha": "^9.2.1",
"mochawesome": "^7.1.2",
"mochawesome-merge": "^4.2.1",
"mochawesome-report-generator": "^6.1.1"
},
"dependencies": {
"mocha-junit-reporter": "^2.0.2",
"save-dev": "^0.0.1-security"
}
}
Cypress Version
9.5.1
Other
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Cannot read properties of undefined (reading 'length') - TrackJS
TypeError is a subset of JavaScript Error that is thrown when code attempts to do something that does not exist on the target...
Read more >TypeError: Cannot read property 'length' of Undefined in JS
The "Cannot read property 'length' of undefined" error occurs when accessing the length property on an undefined value. To solve the error, make...
Read more >Typeerror: Cannot Read Property 'length' of Undefined
A typeerror length of undefined can indicate that the actual type of an operand is different from the expected type. This error can...
Read more >[SOLVED] Cannot Read Property 'length' of Undefined in JS
4 Quick Fixes for the “Cannot Read Property 'length' of Undefined” Error in JavaScript · 1. Use an if Statement · 2. Use...
Read more >Cannot read property length of undefined - Stack Overflow
The error means that what ever element is returned by getElementById('WallSearch') , it does not have a value property. Every form field has...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just ran into the same issue, but it appears to be an issue in mochawesome. I had a utility file with no tests in my cypress/integration folder that was causing the problem. Moving it to a different folder fixed the issue.
Closing this issue because it appears to be an issue with mochawesome rather than Cypress. Let me know if you are still experiencing a problem and I will be happy to reopen this!