Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated HTML reports are empty when running from CI #282

Open
tijnster opened this issue May 27, 2019 · 9 comments
Open

Generated HTML reports are empty when running from CI #282

tijnster opened this issue May 27, 2019 · 9 comments

Comments

@tijnster
Copy link

Describe the bug
Hi!

When I am running my tests locally, then merging and marging my json to html files works fine (I do have to use the Bash terminal, as I am on windows, else I would run into json parsing errors).
However, when i try to do this from Gitlab CI it does generated an HTML report as an artifact, but it remains empty..

Code Reproduce
Yml file:
cypress-e2e:
image: cypress/base:10
stage: test
script:
- npm run cy:run:staging
- npx mochawesome-merge — reportDir mochawesome-report > mochawesome-report/output.json
- npx marge mochawesome-report/output.json
artifacts:
paths:
- mochawesome-report/output.html
expire_in: 1 week

Expected behavior
A fully loaded HTML file with content of the tests.

Screenshots
image

Environment (please complete the following information):

  • Platform Linux
  • mochawesome version 3.1.2
  • mocha 5.2.0
  • Node version 10.15.3

Additional context
Add any other context about the problem here.

@adamgruber
Copy link
Owner

Are you seeing any errors in the logs?

@sagaru
Copy link

sagaru commented Jun 3, 2019

I'm running through same problem, error logs below for your reference...

TypeError: Cannot read property 'passes' of undefined
    at Spec.Base.epilogue (/../../node_modules/mocha/lib/reporters/base.js:319:26)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:121:20)
    at Runner.emit (events.js:211:7)
    at Reporter.emit (/root/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/lib/reporter.js:239:55)
    at Object.server.startWebsockets.onMocha (/root/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/lib/project.js:298:22)
    at Socket.<anonymous> (/root/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/lib/socket.js:235:36)
    at emitTwo (events.js:126:13)
    at Socket.emit (events.js:214:7)
    at /root/.cache/Cypress/3.3.1/Cypress/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)

@sagaru
Copy link

sagaru commented Jun 3, 2019

Looks like the mocha versions since 6.0.0 has this issue

mocha version "5.2.0" works fine without any errors.

@adamgruber
Copy link
Owner

@sagaru I think you mean mocha since the latest version of mochawesome is 3.1.2. Either way, the issue you're describing sounds like #269.

@tijnster Can you provide a link to a repo where the issue can be reproduced?

@YOU54F
Copy link

YOU54F commented Jun 4, 2019

@sagaru @adamgruber I've added up to date information about the fixes to work with Mocha 6 in #269 . I've now implemented it as a non-breaking change :) so it can be used with mocha versions 6+ and below

jasonk added a commit to jasonk/mochawesome that referenced this issue Aug 28, 2019
Mocha 6 introduced a new "stats-collector" that reporters have to
manually instantiate in order to get stats.  If running under Mocha
6 reporters that haven't done this will throw exceptions like `Cannot
read property 'passes' of undefined` or `Cannot read property 'failures'
of undefined`.

fixes adamgruber#269
fixes adamgruber#282
jasonk added a commit to jasonk/mochawesome that referenced this issue Aug 28, 2019
Mocha 6 introduced a new "stats-collector" that reporters have to
manually instantiate in order to get stats.  If running under Mocha
6 reporters that haven't done this will throw exceptions like `Cannot
read property 'passes' of undefined` or `Cannot read property 'failures'
of undefined`.

fixes adamgruber#269
fixes adamgruber#282
@jasonk jasonk mentioned this issue Aug 28, 2019
@ali-heidari
Copy link

ali-heidari commented Jun 18, 2020

Hi everyone, It seems cleaning assets folder inside the report folder can resolve the issue. It won't regenerate the content of the asset if it already exists (Can't recognize the assets belongs to older versions of mochawesome or MARGE?!?!?!?).
I had a look into sources and probably the root of the issue is MARGE (Mochawesome-report-generator) ?!?!?!?!?!

@yoursmunnisha
Copy link

Hello, I am trying to generate reports with mochawesome reports are generating but when I open generated HTML file it is showing empty can anyone please help me with this

here is my package.json
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "test.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "munnisha",
"license": "ISC",
"dependencies": {
"allure-commandline": "^2.13.8",
"assert": "^2.0.0",
"chai": "^4.3.4",
"chrome-launcher": "^0.14.0",
"chrome-remote-interface": "^0.31.0",
"cypress": "^8.1.0",
"exceljs": "^4.2.1",
"fs": "0.0.1-security",
"mocha-allure-reporter": "^1.4.0",
"selenium": "^2.20.0",
"selenium-webdriver": "^4.0.0-beta.4",
"webdriver": "^7.7.7",
"xlsx": "^0.17.0"
},
"devDependencies": {
"mocha": "^9.0.3",
"mochawesome": "^6.2.2",
"mochawesome-merge": "^4.2.0",
"mochawesome-report-generator": "^5.2.0",
"ts-test-decorators": "0.0.6"
}
}

and the report generated HTML file is
Mochawesome Report - Google Chrome 03-08-2021 16_23_51

please help me with this. Otherwise, please provide any reference for report generation with nodejs. For the last 2 days, I am working on it but still didn't clarify. Hope you guys will help me with this

@Pallavi3511
Copy link

@adamgruber @yoursmunnisha me to facing same issue .json file have data but html file do not shows any data.
my configuration is-
image

and when trying to see the html file from editor, throws below error-
image

if any pointers, please let me know.

@xwmyth8023
Copy link

Hi guys, set mochawesome option cdn=true can fix this.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants