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

feat: added optional jsw format to json reporter #5017

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

CheadleCheadle
Copy link

@CheadleCheadle CheadleCheadle commented Oct 17, 2023

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions.

Description of the Change

Added an optional CLI argument ('jsw' or 'jsonStringifyWhitespace') that allows for the user to set the whitespace of the JSON reporter. If it isn't provided it defaults to the current value (2).

This change allows for more customization of the JSON output!
Closes #4889

Alternate Designs

An alternative approach might involve using a boolean CLI argument to toggle the JSON reporter and remove whitespace. However, a more precise level of customization can be achieved by using a CLI argument to control the amount of whitespace instead.

Why should this be in core?

It's a relatively simple change that simplifies the parsing of the JSON output."

Benefits

This feature would prove valuable when parsing JSON test results. For example, Splunk mandates JSON formatting with no whitespace, and having the option to generate whitespace-free JSON would enable Splunk to directly use the data without additional processing.

Possible Drawbacks

There shouldn't be any drawbacks to making this modification. It allows for further customization but is kept default if not specified.

Applicable issues

N/A

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 17, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@JoshuaKGoldberg JoshuaKGoldberg added status: waiting for author waiting on response from OP - more information needed semver-minor implementation requires increase of "minor" version number; "features" labels Mar 4, 2024
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking as waiting for changes per #4889 (comment).

@JoshuaKGoldberg JoshuaKGoldberg changed the title added optional jsw format to json reporter feat: added optional jsw format to json reporter Mar 4, 2024
@CheadleCheadle
Copy link
Author

CheadleCheadle commented Mar 5, 2024

I addressed the changes requested in #4889 (comment).

Instead of jsonStringifyWhiteSpace, I went with indentSize. It is not only shorter and easier to type, but clearer in what it is used for!

@JoshuaKGoldberg JoshuaKGoldberg added status: in triage a maintainer should (re-)triage (review) this issue and removed status: waiting for author waiting on response from OP - more information needed labels Mar 5, 2024
@coveralls
Copy link

Coverage Status

coverage: 94.337% (-0.02%) from 94.359%
when pulling 8d16512 on CheadleCheadle:optional-reporter-format
into 3735873 on mochajs:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor implementation requires increase of "minor" version number; "features" status: in triage a maintainer should (re-)triage (review) this issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 Feature: JSON reporter with optional formatting
3 participants