mirror of
https://github.com/anchore/syft.git
synced 2026-10-31 22:46:36 +01:00
Add "pretty" json configuration and change default behavior to be space-efficient (#2275)
* expose underlying format options Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * remove escape html options and address PR feedback Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * incorporate PR feedback Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * fix cli test Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
@@ -86,7 +86,10 @@ func assertNotInOutput(data string) traitAssertion {
|
||||
func assertNoStderr(tb testing.TB, _, stderr string, _ int) {
|
||||
tb.Helper()
|
||||
if len(stderr) > 0 {
|
||||
tb.Errorf("expected stderr to be empty, but got %q", stderr)
|
||||
tb.Errorf("expected stderr to be empty, but wasn't")
|
||||
if showOutput != nil && *showOutput {
|
||||
tb.Errorf("STDERR:%s", stderr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +99,10 @@ func assertInOutput(data string) traitAssertion {
|
||||
stdout = stripansi.Strip(stdout)
|
||||
stderr = stripansi.Strip(stderr)
|
||||
if !strings.Contains(stdout, data) && !strings.Contains(stderr, data) {
|
||||
tb.Errorf("data=%q was NOT found in any output, but should have been there\nSTDOUT:%s\nSTDERR:%s", data, stdout, stderr)
|
||||
tb.Errorf("data=%q was NOT found in any output, but should have been there", data)
|
||||
if showOutput != nil && *showOutput {
|
||||
tb.Errorf("STDOUT:%s\nSTDERR:%s", stdout, stderr)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user