open-policy-agent / conftest

Write tests against structured configuration data using the Open Policy Agent Rego query language
https://conftest.dev
Other
2.86k stars 304 forks source link

Conftest does not output detailed summary report #872

Open blazerrt86899 opened 1 year ago

blazerrt86899 commented 1 year ago

When running conftest test -o json >results.json , It is giving output only success count. How do I get a detailed output summary.

  1. How many test cases ran
  2. How many success and details about it
  3. How many failed and details about it
boranx commented 1 year ago

I think that's because the "0" values are being omitted while the result set is being marshaled (https://github.com/open-policy-agent/conftest/blob/master/output/json.go#L37) You might have already noticed total numbers and pretty-printing are done by the implementors of the various output types, and there are repetitive code-blocks that individually do this for each output type (like: https://github.com/open-policy-agent/conftest/blob/v0.46.0/output/standard.go#L99) Therefore, we might consider exporting the common logic to re-usable components/functions where we can call from various output types