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.

Context information is lost in final report when running in mocha parallel mode

See original GitHub issue

Describe the bug Using addContext has no effect in final report when running tests in parallel using mocha ‘parallel’ mode

Code Reproduce run test in parallel mode with code to add context in report file. For instance :

const addContext = require("mochawesome/addContext")
...
describe("My testsuite", function () {

            beforeEach(function () {
                addContext(this, "this is a contextual info");
            });

            it("my test", function (done) {
                expect(true).to.be.true;
            });

});

Expected behavior Context should be added in testcase when expanding test in HTML report, this works well when we run tests not in parallel mode (–parallel)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
JakobsenA-ELScommented, Dec 16, 2020

Try running Mocha with --require mochawesome/register.

3reactions
GoldStrikeArchcommented, Dec 18, 2020

I can confirm that using require("mochawesome/register"); inside .test.js file is solving the problem. It would be really nice if it worked without that tho…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Context information is lost in final report when running in mocha ...
Describe the bug. Using addContext has no effect in final report when running tests in parallel using mocha 'parallel' mode. Code Reproduce
Read more >
Testing in parallel with Mocha v8.0.0
js. Running tests in parallel mode allows Mocha to take advantage of multi-core CPUs, resulting in significant speedups for large test suites.
Read more >
How To Generate Mocha Reports With Mochawesome?
Learn how to generate Mocha reports and use Mocha report generator Mochawesome, a popular and easy-to-use Mocha reporter for Selenium test ...
Read more >
Getting Started with Node.js and Mocha - Semaphore Tutorial
json file, in order to run our tests simply by executing npm test from the command line. The following command is used to...
Read more >
mochajs/mocha - Gitter
BeforeAll root hook seems like a good option, however in parallel mode it runs once per file. Is there an alternate to running...
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