Skip to content

Commit

Permalink
fix syft-json test to use pretty json for snapshot testing (anchore#2441
Browse files Browse the repository at this point in the history
)

without this fix, capturing fixtures will result in hard-to-read
failures in testing.

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
  • Loading branch information
wagoodman authored Dec 15, 2023
1 parent eb43218 commit 3cf6d76
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion syft/format/syftjson/encoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,15 @@ func TestEncodeFullJSONDocument(t *testing.T) {
},
}

cfg := DefaultEncoderConfig()
cfg.Pretty = true
enc, err := NewFormatEncoderWithConfig(cfg)
require.NoError(t, err)

testutil.AssertEncoderAgainstGoldenSnapshot(t,
testutil.EncoderSnapshotTestConfig{
Subject: s,
Format: NewFormatEncoder(),
Format: enc,
UpdateSnapshot: *updateSnapshot,
PersistRedactionsInSnapshot: true,
IsJSON: true,
Expand Down

0 comments on commit 3cf6d76

Please sign in to comment.