Skip to content

Commit

Permalink
chore: pretty print output for snapshot tests
Browse files Browse the repository at this point in the history
Syft no longer defaults to pretty-printed JSON. This change made snapshot diffs
unreadable. Therefore, set integration tests to configure syft to pretty print
SBOMs.

Signed-off-by: Will Murphy <[email protected]>
  • Loading branch information
willmurphyscode committed Dec 3, 2023
1 parent 1ddf710 commit 8931d67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/integration/formatExports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as github from "@actions/github";
import * as fs from "fs";
import * as client from "../../src/github/GithubClient";
import { runSyftAction } from "../../src/github/SyftGithubAction";
import path from "path";

jest.setTimeout(30000);
Date.now = jest.fn(() => 1482363367071);
Expand Down Expand Up @@ -65,6 +66,8 @@ const testSource = async (source: string, format = "spdx"): Promise<string> => {
// SPDX-json is not consistently sorted,
// so we sort text SPDX output for snapshots
return format;
case "config":
return path.join("tests","integration", "syft_config.yaml");
}
return "";
});
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/syft_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
format:
pretty: true

0 comments on commit 8931d67

Please sign in to comment.