Use `mocha --opts` command to run tests, it is fail to genarate the report when assert fail
See original GitHub issue1.The test suite :
var assert = require("chai").assert;
describe("# Hello, world!", function () {
it("1+1=2",function(){
assert.equal(1+1,3);
assert.ok('Hello, world!');
})
});
2.mocha.opts :
--reporter mochawesome
--reporter-options reportDir=mochawesome-report,reportFilename=mocha-helloworld,reportTitle=mocha-helloworld,reportPageTitle="Helloworld-Report",overwrite=true
--timeout 200
3.run mocha command
>mocha --opts mocha.opts
- it is fail to genarate the report
## Hello, world!
1) 1+1=2
## mysql test
undefined
√ query (144ms)
## https://www.github.com
2) github
1 passing (385ms)
2 failing
Issue Analytics
- State:
- Created 6 years ago
- Comments:29 (8 by maintainers)
Top Results From Across the Web
Command-line usage - mocha - w3resource
Non-compliant tests are marked as failures. #--bail, -b. This will cause Mocha to stop running tests after the first test failure it encounters....
Read more >Mocha - the fun, simple, flexible JavaScript test framework
simple, flexible, fun. Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun....
Read more >node.js - Mocha isn't displaying any details for failed tests
Turns out that Mocha is fine and my test definitions are fine, I had simply fixed a totally different migration issue incorrectly.
Read more >Mocha - API Manual
Mocha tests run serially, allowing for flexible and accurate reporting, ... you to use any assertion library you want, if it throws an...
Read more >How To Test a Node.js Module with Mocha and Assert
Testing is an integral part of software development. It's common for programmers to run code that tests their application as they make changes ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Had another test box (Mac OS) where this was failing to generate reports. Go it working, but still not quite sure how. Things I did:
Before this, when I ran mocha from the command line, it would not find the mochawesome reporter; now it does (mocha tests/bugTest.js --reporter mochawesome). If I run ‘npm test’, it works. If I try ‘npm run test’, I get the ELIFECYCLE error mentioned in previous comment.
That’s kind of a mess of clues, but if you revert to an earlier instance of npm, then remove and reinstall mocha, I bet you can reproduce this.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.