question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[mochawesome] Error: Unable to save mochawesome-reports/mochawesome.html

See original GitHub issue

Hi

I am not able to get the json/html reports in the reports folder. I run the tests using this command: mocha test --reporter mochawesome (all my tests are inside the "test" folder) And, I get this error:

[mochawesome] Error: Unable to save mochawesome-reports/mochawesome.json Error: ENOENT: no such file or directory, open ‘mochawesome-reports/mochawesome.json’ [mochawesome] Error: Unable to save mochawesome-reports/mochawesome.html Error: ENOENT: no such file or directory, open ‘mochawesome-reports/mochawesome.html’ [mochawesome] Report saved to mochawesome-reports/mochawesome.html

And the mochawesome-reports contains:

tree mochawesome-reports/
mochawesome-reports/
|-- css
|   |-- mochawesome-64.css
|   `-- mochawesome.css
|-- fonts
|   |-- mochawesome.eot
|   |-- mochawesome.svg
|   |-- mochawesome.ttf
|   |-- mochawesome.woff
|   |-- Roboto+Condensed_300_normal.ttf
|   |-- Roboto+Condensed_300_normal.woff
|   |-- Roboto+Condensed_400_normal.svg
|   |-- Roboto+Condensed_400_normal.ttf
|   |-- Roboto+Condensed_400_normal.woff
|   |-- Roboto+Condensed_700_normal.ttf
|   |-- Roboto+Condensed_700_normal.woff
|   |-- Roboto+Slab_400_normal.svg
|   |-- Roboto+Slab_400_normal.ttf
|   `-- Roboto+Slab_400_normal.woff
`-- js
    |-- mochawesome.js
    `-- vendor.js

3 directories, 18 files

How can i get this working?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
adamgrubercommented, May 19, 2016

@codeSasquatch Thanks for the test code. I was able to use it to debug. The issue actually lies in how selenium-webdriver is wrapping the test function. They don’t seem to properly handle pending tests.

If you replace

c.test.it('View Google and Enter in mochawesome');

with

c.test.xit('View Google and Enter in mochawesome', function(done) {
  done();
});

everything will work properly and your test will still be labeled as pending.

1reaction
adamgrubercommented, May 19, 2016

@ramyaa Thanks for the sample. It fails for you because you are changing the working directory during the test. The initial reporter directory and files are created/copied before the tests begin to run so when that happens the working directory is sample/. After your tests run, the working directory has changed to private/var/folders/... and so the reporter cannot find the sample/mochawesome-reports directory and nothing is saved.

If you need to change the working directory inside your tests, make sure you change them back in the after() method and it should work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Name of the mochawesome report is not saving as expected ...
when I ran my tests, the reports are generated with name 'sample.html' which is expected as I have defined my report title as...
Read more >
mochawesome - npm
Start using mochawesome in your project by running `npm i mochawesome`. ... html, boolean, true, Save the HTML output for the test run....
Read more >
Using Mochawesome Reporter with Cypress
Mochawesome reporter is a custom reporter which generates a standalone HTML/CSS report to help visualize your test runs.
Read more >
mochawesome/general - Gitter
Hi , I am trying mochawesome and it is overwriting the json and html file . ... I am getting this error -...
Read more >
How to use the mochawesome-report-generator.create ... - Snyk
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
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