adamgruber / mochawesome

A Gorgeous HTML/CSS Reporter for Mocha.js
https://gitter.im/mochawesome/general
MIT License
1.06k stars 160 forks source link

Generated HTML reports are empty when running from CI #282

Open tijnster opened 5 years ago

tijnster commented 5 years ago

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:

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

Screenshots image

Environment (please complete the following information):

Additional context Add any other context about the problem here.

adamgruber commented 5 years ago

Are you seeing any errors in the logs?

sagaru commented 5 years ago

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 commented 5 years ago

Looks like the mocha versions since 6.0.0 has this issue

mocha version "5.2.0" works fine without any errors.

adamgruber commented 5 years ago

@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 commented 5 years ago

@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

ali-heidari commented 4 years ago

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 commented 3 years ago

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 commented 3 years ago

@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 commented 2 years ago

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