-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃殌 Feature: Make reporter options standard #3480
Comments
Perhaps simpler to have a An extension of the settings file would turn settings = {
reporterOptions: {
_augment: {
//useColors
//useInlineDiffs
//hideDiff
//suiteName
},
_override: {},
spec: {
stdout: '-' // console
},
xunit: {
stdout: '/path/to/xunit.xml'
},
// other reporters
},
timeout: 75,
// etc.
} |
I think it is a good idea to add a structure that allows to specify options to individual reporters, and allow for multiple reporters. It might also be a good idea to only pass the specific reporters options to a reporter when constructing it. Maybe even take it one step further and only pass I don't think it is a good idea to have a set of common options to all reporters. For example |
@johanblumenberg wrote:
I thought I had said that, but not explicitly enough. Yes, exactly.
As you said, you could grab those from
Poorly named. Maybe better would be to have
I was of two minds here since you might want colors in your output. If you really wanted to save your |
Ok, then I misread. Cool. Although it would be difficult to change the reporter constructor arguments without a new major, and a rewrite of all reporters...
Ok, I get your point.
Yes, that's true. It should be configurable per reporter then anyway. But if I understand your proposal above correct, you are actually proposing that it would be configurable per reporter, but if one wants to have it the same for all reporters, one could add it to the |
Self-referencing. I know it's ugly, but backwards compatible! reporterOptions = {
foo: "bar",
reporterOptions: undefined
};
reporterOptions.reporterOptions = reporterOptions; // [Circular]
reporterOptions.foo === reporterOptions.reporterOptions.foo |
Assuming cmdline processing of reporterOptions = _.merge({ reporterOptions: undefined },
settings.reporterOptions._augment,
settings.reporterOptions[options.reporter],
settings.reporterOptions._override);
reporterOptions.reporterOptions = reporterOptions; |
@plroebuck Yes, that might work |
Related discussion in #3487 |
This is pretty interesting for us too. We recently kicked out a beta version of Mochaterial, an ES6 reporter for the browser, and I ran into some issues with the The main issue was that The less pressing issue is just general clarity. For example, our reporter supports |
Per #5027, we're trying to avoid making big changes that don't have a lot user demand. This hasn't been touched since 2019 and would be a breaking change to reporter options, I think. Closing out as wontfix. If someone things I'm wrong to close this out, great! Please file a new issue with your reasoning and a link to this one. The new issue templates will prompt for the context we'd need to be able to re-triage this. We'd be happy to take a look. Cheers all! 馃 |
Description
reporterOptions
a standard object withinMocha.options
.Mocha.options
asreporterOptions
properties:useColors
useInlineDiffs
hideDiff
options
.Mocha.run()
to passoptions.reporterOptions
to reporter constructor. Currently passesoptions
, but most Mocha option properties are not applicable/unused by reporter.XUnit
reporter constructor to expectoptions.reporterOptions
Base
reporter settings portion ofMocha.run()
toBase
reporter constructor (or somewhere more related).The text was updated successfully, but these errors were encountered: