adamgruber / mochawesome

A Gorgeous HTML/CSS Reporter for Mocha.js
https://gitter.im/mochawesome/general
MIT License
1.06k stars 160 forks source link

mochawesome report options not working #359

Closed mmatra closed 3 years ago

mmatra commented 3 years ago

We recently upgraded mochawesome version and post update we see report options which we have configured are not being used. The code was working fine from last 2 years, but now suddenly after the update it stopped. Below

module.exports = {
    diff: true,
    extension: ['js', 'ts'],
    opts: false,
    timeout: 50000,
    reporter: 'mochawesome',
    'reporter-options': [
        'reportDir=./test-reports/tests/',
        'reportFilename=test-reports',
        'enableCode=false'
    ],
    require: [
        path.resolve(__dirname, './test/jsdom-injection.js')
    ]
};

Versions used previously

"dependencies": {
        "@types/mocha": "~8.2.0",
        "jsdom": "~16.5.0",
        "jsdom-global": "~3.0.0",
        "mocha": "~8.2.0",
        "mochawesome": "~6.2.0",
        "mochapack": "~2.0.0"
    },

New versions which we are using now

"dependencies": {
        "@types/mocha": "~8.2.0",
        "jsdom": "~16.6.0",
        "jsdom-global": "~3.0.0",
        "mocha": "~9.0.0",
        "mochapack": "~2.1.0",
        "mochawesome": "~6.2.0"
    }

We never used to see code in our test report when we introduced 'enableCode=false' Now after updating moch and mochapack enableCode option is not working. Even the report name is different than what we have configured in report options.

mmatra commented 3 years ago

Found one more change. We recently migrated from webpack 4 to webapck 5, can this cause an issue ?

adamgruber commented 3 years ago

I'm not able to reproduce the issue you are seeing. If possible, can you provide a small example repo illustrating the issue?

paztis commented 3 years ago

issue is resolved internally. 'reporter-options' is transformed in 'reporter-option' with lib/cli/options loadOption method

That's why when you try to read the output of the function, 'reporter-options' was undefined as everything is in 'reporter-option' (the official one, 'reporter-options' is only an alias)

You just don't read at the correct place

mmatra commented 3 years ago

Thanks @paztis for your help. @adamgruber , Thanks for your support and time.