There is a bug with latest Mochawesome.
The Mochawesome files are not generated.
The Mochawesome files are generated.
Install latest version of Mochawesome and run a cypress test suite.
Our tests are checking against version 1.5.3
of mochawesome, which IS working properly. They seem to have updated how the reports are generated since then and the reports are not generating properly in their latest version (2.3.0
).
Workaround: For now, you could set your mochawesome package version to 1.5.3
and get the generated reports.
@jennifer-shehane Are there any plans to support the latest mochawesome version? As it allows lot more options then version 1.5.3. Thanks!!
yeah, we should upgrade and test against mocha v2
Thank you Gleb for your response. I have found a workaround for now to timestamp my reports - I am reading the current time from bash and formatting it for reportName
cypress run --reporter mochawesome --reporter-options reportDir=reports,reportName=ā${ENV_IMGTAG:-none}$(date ā+%Y%m%d_%H%M%Sā)ā,overwrite=false
wow that is a hairy command š
Yeah, i know it's not ideal but needed to get the tests working quickly.
Seems we do not properly call reporter.done
to actually save the report too
function done (failures) {
if (reporter.done) {
reporter.done(failures, fn);
} else {
fn && fn(failures);
}
}
return runner.run(done);
I am running into the same issue with v2, So for now is the solution to use 1.5.3?
Got my mochawesome reports working once I rolled back to 1.5.3.
@bahmutov I ran into an issue with mochawesome not generating a report when there is a test failure. Do you think it has to do with the issue you brought up? I get the following stack trace:
TypeError: test.titlePath is not a function
at /Users/my/repo/node_modules/mocha/lib/reporters/base.js:227:10
at Array.forEach (native)
at Function.exports.list (/Users/my/repo/node_modules/mocha/lib/reporters/base.js:167:12)
at Spec.Base.epilogue (/Users/my/repo/node_modules/mocha/lib/reporters/base.js:344:10)
at emitOne (events.js:101:20)
at Runner.emit (events.js:188:7)
at Reporter.emit (/Users/my/repo/node_modules/cypress/dist/Cypress.app/Contents/Resources/app/packages/server/lib/reporter.js:168:55)
at Object.server.startWebsockets.onMocha (/Users/my/repo/node_modules/cypress/dist/Cypress.app/Contents/Resources/app/packages/server/lib/project.js:224:22)
at Socket.<anonymous> (/Users/my/repo/node_modules/cypress/dist/Cypress.app/Contents/Resources/app/packages/server/lib/socket.js:237:36)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at /Users/my/repo/node_modules/cypress/dist/Cypress.app/Contents/Resources/app/packages/socket/node_modules/socket.io/lib/socket.js:503:12
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
TypeError: test.titlePath is not a function
at /Users/my/repo/node_modules/mocha/lib/reporters/base.js:227:10
at Array.forEach (native)
at Function.exports.list (/Users/my/repo/node_modules/mocha/lib/reporters/base.js:167:12)
at Spec.Base.epilogue (/Users/my/repo/node_modules/mocha/lib/reporters/base.js:344:10)
at emitOne (events.js:101:20)
at Runner.emit (events.js:188:7)
at Reporter.emit (/Users/my/repo/node_modules/cypress/dist/Cypress.app/Contents/Resources/app/packages/server/lib/reporter.js:168:55)
at Object.server.startWebsockets.onMocha (/Users/my/repo/node_modules/cypress/dist/Cypress.app/Contents/Resources/app/packages/server/lib/project.js:224:22)
at Socket.<anonymous> (/Users/my/repo/node_modules/cypress/dist/Cypress.app/Contents/Resources/app/packages/server/lib/socket.js:237:36)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at /Users/my/repo/node_modules/cypress/dist/Cypress.app/Contents/Resources/app/packages/socket/node_modules/socket.io/lib/socket.js:503:12
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
Got the same issue with @wichopy
@hululuxin Found out what caused it. Was not related to cypress. mocha is a dependency of mochawesome. You need to npm install mocha@3
as the latest version of mocha introduced breaking changes to mochawesome.
@wichopy I have tried mocha3 and it works. Thanks you so much.
Not sure if this is related, but using mochawesome 1.5.3 prevents a non-zero error codes from cypress run
. Just letting @hululuxin and @wichopy know.
I got around this issue with mocha-multi-reporters
even if mochawesome
is the only reporter listed
just ran into this. would be nice if the reporter documentation was updated with a note of this until it is fixed
@cameronc56 Our documentation is open source and contributions are welcome. š Reporters guide is here: https://github.com/cypress-io/cypress-documentation/blob/develop/source/guides/guides/reporters.md
same problem here only generates css, js, fonts folders no html
I didn't realize mochaawesome was preventing this. We'll get it fixed.
There are a few different problems in play here and I'll be opening issues for each of them.
So far I have found three:
mochawesome
does not correctly output a stats object when failures occur in hooks. https://github.com/cypress-io/cypress/issues/1063 and https://github.com/cypress-io/cypress/issues/1141test.titlePath
is not a function when using newer versions of mocha
with mochawesome
. This is easy to fix, we will simply polyfill this on Suite
and Runnable
classes. https://github.com/cypress-io/cypress/issues/1142reporter.done()
when a run is finishedAll the linked issues are closed now, does this mean it will get fixed in the next release?
Yes, next release has these all fixed.
Released in 1.4.2
.
@brian-mann I am facing an interesting issue. I am not able to generate mochawesome reports if I am running full suite in CLI, but it works like a charm when using it with --spec
My Setup details:
OS: windows
cypress verison : 2.1.0
mochawesome version : 3.0.2
I have mochawesome working here -> https://github.com/testdrivenio/cypress-mochawesome-s3
Essentially-
Most helpful comment
Released in
1.4.2
.