The mochawesome reporter is not working with the cypress

See original GitHub issue

Current behavior:

I have installed package by running the command:

npm install --save-dev mocha mochawesome mochawesome-merge mochawesome-report-generator

Then If I add the line "reporter" : "mochawesome" in the cypress.json, I am getting below error:

  Running: packages\single-site\dup-archive\mysqldump.js...                               (1 of 10)
"[object Object]" reporter blew up with error:
AssertionError [ERR_ASSERTION]: path must be a string
    at Module.require (module.js:512:3)
    at require (internal/module.js:11:18)
    at Mocha.reporter (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\node_modules\mocha\lib\mocha.js:167:21)
    at new Mocha (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\node_modules\mocha\lib\mocha.js:88:8)
    at Reporter.setRunnables (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\lib\reporter.js:196:20)
    at Object.onSetRunnables (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\lib\project.js:288:46)
    at Socket.<anonymous> (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\lib\socket.js:233:21)
    at emitTwo (events.js:125:13)
    at Socket.emit (events.js:213:7)
    at C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\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)

Error: invalid reporter "[object Object]"
    at Mocha.reporter (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\node_modules\mocha\lib\mocha.js:180:13)
    at new Mocha (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\node_modules\mocha\lib\mocha.js:88:8)
    at Reporter.setRunnables (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\lib\reporter.js:196:20)
    at Object.onSetRunnables (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\lib\project.js:288:46)
    at Socket.<anonymous> (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\lib\socket.js:233:21)
    at emitTwo (events.js:125:13)
    at Socket.emit (events.js:213:7)
    at C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\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)

Error: invalid reporter "[object Object]"
    at Mocha.reporter (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\node_modules\mocha\lib\mocha.js:180:13)
    at new Mocha (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\node_modules\mocha\lib\mocha.js:88:8)
    at Reporter.setRunnables (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\lib\reporter.js:196:20)
    at Object.onSetRunnables (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\lib\project.js:288:46)
    at Socket.<anonymous> (C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\Cypress\resources\app\packages\server\lib\socket.js:233:21)
    at emitTwo (events.js:125:13)
    at Socket.emit (events.js:213:7)
    at C:\Users\admin\AppData\Local\Cypress\Cache\3.1.5\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)

Versions

Operating System: Windows 10 Cypress: Latest

Thank you very much

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

38reactions
AlbinoDroughtcommented, Apr 12, 2019

I just had this issue. The solution in https://github.com/cypress-io/cypress/issues/3426#issuecomment-462622820 did not work for me.

The issue seems to stem from Reporter.loadReporter and me having a mochawesome.json in my current working directory. Reporter.loadReporter prefers require-able files in the local directory over require-able packages, and mochawesome.json (as generated in the Multiple Reporters example) is a require-able file in the local directory.

Here’s what my debug log showed:

trying to load reporter: mochawesome
trying to require local reporter with path: /home/sean/projects/frontend/mochawesome

"[object Object]" reporter blew up with error:
AssertionError [ERR_ASSERTION]: path must be a string
    at Module.require (module.js:512:3)
    at require (internal/module.js:11:18)

The solution for me was to remove the mochawesome.json file which was generated after merging my mochawesome reports 😄

20reactions
sebillac81commented, Apr 21, 2019

I removed the mochawesome.json file from the root directory, and it’s work for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The mochawesome reporter is not working with the cypress
Current behavior: I have installed package by running the command: npm install --save-dev mocha. npm install --save-dev mochawesome.
Read more >
cypress-mochawesome-reporter - npm
Start using cypress-mochawesome-reporter in your project by running `npm i cypress-mochawesome-reporter`. There are 10 other projects in the ...
Read more >
Using Mochawesome Reporter with Cypress
This is a problem because we need one single report for the complete run (which include multiple specs). Solution: mochawesome-merge can be used ......
Read more >
Cannot find module 'cypress-mochawesome-reporter/plugin ...
I have never used docker before. When I run it in my local it will be working fine but when I run using...
Read more >
Cypress — merging multiple mochawesome reports | by Kristijan
In my last post I described how to set up mochawesome reports for Cypress tests. However, I also mentioned at the end of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found