TypeError: Cannot read property 'passes' of undefined
See original GitHub issueI’ve installed the latest mocha, mochawesome, cypress etc,but when i run ‘npm test’,No test report was generated. package.json:
{
"name": "cypresstest",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"cypress": "^3.1.5"
},
"devDependencies": {
"mocha": "^6.0.1",
"mochawesome": "^3.1.1",
"mochawesome-merge": "^1.0.5",
"mochawesome-report-generator": "^3.1.5"
},
"scripts": {
"cypress:open": "cypress open",
"test": "cypress run --reporter mochawesome"
},
"author": "",
"license": "ISC",
"description": ""
}
exception:
TypeError: Cannot read property 'passes' of undefined
at Spec.Base.epilogue (/Users/tianyawei/Applications/CypressTest/node_modules/mocha/lib/reporters/base.js:318:25)
at Object.onceWrapper (events.js:316:30)
at emitOne (events.js:120:20)
at Runner.emit (events.js:210:7)
at Reporter.emit (/Users/tianyawei/Library/Caches/Cypress/3.1.5/Cypress.app/Contents/Resources/app/packages/server/lib/reporter.js:239:55)
at Object.server.startWebsockets.onMocha (/Users/tianyawei/Library/Caches/Cypress/3.1.5/Cypress.app/Contents/Resources/app/packages/server/lib/project.js:296:22)
at Socket.<anonymous> (/Users/tianyawei/Library/Caches/Cypress/3.1.5/Cypress.app/Contents/Resources/app/packages/server/lib/socket.js:237:36)
at emitTwo (events.js:125:13)
at Socket.emit (events.js:213:7)
at /Users/tianyawei/Library/Caches/Cypress/3.1.5/Cypress.app/Contents/Resources/app/packages/socket/node_modules/socket.io/lib/socket.js:503:12
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
TypeError: Cannot read property 'passes' of undefined
at Spec.Base.epilogue (/Users/tianyawei/Applications/CypressTest/node_modules/mocha/lib/reporters/base.js:318:25)
at Object.onceWrapper (events.js:316:30)
at emitOne (events.js:120:20)
at Runner.emit (events.js:210:7)
at Reporter.emit (/Users/tianyawei/Library/Caches/Cypress/3.1.5/Cypress.app/Contents/Resources/app/packages/server/lib/reporter.js:239:55)
at Object.server.startWebsockets.onMocha (/Users/tianyawei/Library/Caches/Cypress/3.1.5/Cypress.app/Contents/Resources/app/packages/server/lib/project.js:296:22)
at Socket.<anonymous> (/Users/tianyawei/Library/Caches/Cypress/3.1.5/Cypress.app/Contents/Resources/app/packages/server/lib/socket.js:237:36)
at emitTwo (events.js:125:13)
at Socket.emit (events.js:213:7)
at /Users/tianyawei/Library/Caches/Cypress/3.1.5/Cypress.app/Contents/Resources/app/packages/socket/node_modules/socket.io/lib/socket.js:503:12
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR! Test failed. See above for more details.
tianyaweideMacBook-Pro:CypressTest tianyawei$
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:9 (2 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'passes' of undefined #4304
Desired behavior: Generated Html reports from running the tests. Steps to reproduce: (app code and test code). I have followed everything from ...
Read more >Cannot read property 'passes' of undefined using Cypress ...
javascript - Got TypeError: Cannot read property 'passes' of undefined using Cypress when generating mochawesome report - Stack Overflow. Stack ...
Read more >Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError: Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an undefined...
Read more >How to Prevent the Error: Cannot Read Property '0' of Undefined
A guide on how to prevent the error "cannot Read Property '0' of Undefined", covering techniques such as try, catch, using const over...
Read more >M220JS, Ticket:Connection TypeError: Cannot read property ...
I am starting M220JS and got to the ticket:connection at the end of Chapter 0. ... TypeError: Cannot read property 'close' of undefined....
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
Updated instructions
I’ve now updated, tested and released updated modules that fix this with mocha 6, but also retains backwards compatibility with mocha 5 and earlier versions.
https://www.npmjs.com/package/cypress-multi-reporters https://www.npmjs.com/package/mocha-junit-reporters
Example against Mocha 5 Example against Mocha 6
the changes required are minimal
npm i mocha-junit-reporters
npm i cypress-multi-reporters
in reporterOpts.json
in cypress.json
See https://github.com/YOU54F/cypress-docker-typescript/pull/22/files
Hopefully the PR’s will be merged in the source repo’s soon but for now, enjoy
Any news on this matter? Meanwhile Cypress 4.0 has been released and they now require Mocha 7.0.1 (https://docs.cypress.io/guides/references/migration-guide.html#Migrating-to-Cypress-4-0)