Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set configurations for reporters directly inside reporterOptions #31

Closed
AlehVasilyeu opened this issue Jan 17, 2017 · 3 comments · Fixed by #32
Closed

Set configurations for reporters directly inside reporterOptions #31

AlehVasilyeu opened this issue Jan 17, 2017 · 3 comments · Fixed by #32

Comments

@AlehVasilyeu
Copy link

It would be great to set configurations for reporters directly inside reporterOptions.

Expected behavior

Pass all configuration in reporterOptions instead specifying reporterOptions.configFile

Actual behavior

Need to create config.json

@stanleyhlng
Copy link
Owner

Hi @AlehVasilyeu,

Thank you for your suggestions, that's a good idea to pass options directly instead of specifying an external config.json file

Do you have any proposal?

CURRENT IMPLEMENTATION w/ CONFIG.JSON

$ ./node_modules/.bin/mocha --reporter mocha-multi-reporters --reporter-options configFile=config.json

// File: config.json
{
    "reporterEnabled": "tap, xunit",
    "xunitReporterOptions": {
        "output": "xunit-custom.xml"
    }
}

@AlehVasilyeu
Copy link
Author

AlehVasilyeu commented Jan 20, 2017

Hi @stanleyhlng,

Mocha can get reporter options programatically

var mocha = new Mocha({
  reporter: 'mocha-multi-reporters',
  reporterOptions: {
    ...
  }
});

What if reporterOptions will be configured like this:

reporterOptions: 
   config: [
     {
        reporter: "reporter1",
        reporterOptions: { }
     },
     {
        reporter: "reporter2",
        reporterOptions: { }
     }
   ],
   // config.js is alternative name, `configFile` uses by default if `config` is not defined
   configFile: "config.json"

And maybe somehow combine with previous implementation, so it will be possible to use CLI also.

What do you think? :)

@panmona
Copy link

panmona commented Jan 31, 2023

Is there any way to supply the additional options via the CLI as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants