numirias / pytest-json-report

🗒️ A pytest plugin to report test results as JSON
MIT License
147 stars 39 forks source link

Include indentation in the JSON report #8

Closed jacebrowning closed 6 years ago

jacebrowning commented 6 years ago

If this plugin called json.dumps() with indent=2 it would help to make the report human readable.

Could this be the default or at least an option? Thanks!

numirias commented 6 years ago

Making it default is unfortunately not an option because the leading spaces will increase the report size even more. But I added --json-report-indent which you can use to supply an indentation level. I'll include it in the next release.

That said, you can also easily view or convert a JSON file to match your desired indentation, e.g. with json.tool:

python -m json.tool .report.json