From 8ae151bef74750a36322dab83b8d1ff74cfaef3a Mon Sep 17 00:00:00 2001 From: Will Murphy Date: Sun, 3 Dec 2023 05:54:32 -0500 Subject: [PATCH] chore: pretty print output for snapshot tests 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 --- tests/integration/formatExports.test.ts | 3 +++ tests/integration/syft_config.yaml | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 tests/integration/syft_config.yaml diff --git a/tests/integration/formatExports.test.ts b/tests/integration/formatExports.test.ts index 040e7433..444ecc82 100644 --- a/tests/integration/formatExports.test.ts +++ b/tests/integration/formatExports.test.ts @@ -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); @@ -65,6 +66,8 @@ const testSource = async (source: string, format = "spdx"): Promise => { // 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 ""; }); diff --git a/tests/integration/syft_config.yaml b/tests/integration/syft_config.yaml new file mode 100644 index 00000000..55154156 --- /dev/null +++ b/tests/integration/syft_config.yaml @@ -0,0 +1,2 @@ +format: + pretty: true