Search code examples
typescriptmocha.jsmochawesome

Mochawesome reporter outputs incorrect json results while using Mocha's this.retries() api


Though I see an open issue about this , Wanted to check if we have a workaround, any suggestions appreciated ? :

only while using this.retries(), I see the json results showing null for the elements state and speed the elements pass , fail as false and err is empty, also as the result of which the html report looks incorrect . Here's my test

describe(`Page Load checks `, async function ()  {

it('Page Check', async function () {
        this.retries(1); 
        presentationsPage = await navMenu.loadPresentationsPage();
        const result = await presentationsPage.isPresentationsPageLoadComplete();
        expect(result).to.equal(true, 'Expected : Presentation Page');
    }) ;
 } );

and the json results

{
              "title": "Page Check",
              "fullTitle": "Page Loads  Check",
              "timedOut": false,
              "duration": 32014,
              "state": null,
              "speed": null,
              "pass": false,
              "fail": false,
              "pending": false,
              "context": null,
              "code": "__awaiter(this, void 0, void 0, function...",
              "err": {},
              "uuid": "6971b4af-b327bda4ffa8",
              "parentUUID": "3345841e-6a5f-19fee98",
              "isHook": false,
              "skipped": true
            }

Solution

  • In case any one lands into the same issue while using retries(), I switched to a reporting framework called mocha-allure-reporter . I found this to be a great reporting framework.