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
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/cli/run-option-metadata.js
Expand Up @@ -49,7 +49,7 @@ const TYPES = (exports.types = {
'sort',
'watch'
],
number: ['retries', 'jobs'],
number: ['retries', 'jobs', 'jsonStringifyWhitespace'],
string: [
'config',
'fgrep',
Expand Down Expand Up @@ -78,6 +78,7 @@ exports.aliases = {
ignore: ['exclude'],
invert: ['i'],
jobs: ['j'],
jsonStringifyWhitespace: ['jsw'],
'no-colors': ['C'],
'node-option': ['n'],
parallel: ['p'],
Expand Down
2 changes: 1 addition & 1 deletion lib/reporters/json.js
Expand Up @@ -78,7 +78,7 @@ function JSONReporter(runner, options = {}) {

runner.testResults = obj;

var json = JSON.stringify(obj, null, 2);
var json = JSON.stringify(obj, null, options.jsonStringifyWhitespace ?? 2);
if (output) {
try {
fs.mkdirSync(path.dirname(output), {recursive: true});
Expand Down