🚀 Feature: JSON reporter with optional formatting #4889
Labels
area: reporters
involving a specific reporter
status: accepting prs
Mocha can use your help with this one!
type: feature
enhancement proposal
Is your feature request related to a problem or a nice-to-have?? Please describe.
The problem is the Mocha JSON reporter is hardcoded to output the JSON object over multiple lines. This makes it impossible to use with Splunk which requires the object to just be on one line.
This is the line of code I am referring to: https://github.com/mochajs/mocha/blob/master/lib/reporters/json.js#L81
Describe the solution you'd like
I would like the spacing in the JSON reporter output to be an option so we can configure this as required.
We could add a option to the reporter which allows the user to set the whitespace, but defaults to the current value if it's not provided so the change is backwards compatible.
For example, the line I linked above would be changed to something like this:
Describe alternatives you've considered
An alternative is forking the code and creating my own reporter, but it is such a small change and I believe the community would benefit from this extra option so I would rather make the change here.
The text was updated successfully, but these errors were encountered: