Skip to content

Commit

Permalink
fix(code): Support single file test for golang native implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterSchafer authored and j-luong committed Feb 12, 2025
1 parent d27681a commit 65b8011
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cliv2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/snyk/cli-extension-sbom v0.0.0-20241016065306-0df2be5b3b8f
github.com/snyk/container-cli v0.0.0-20240821111304-7ca1c415a5d7
github.com/snyk/error-catalog-golang-public v0.0.0-20250121101159-e6a61b2bfae6
github.com/snyk/go-application-framework v0.0.0-20250205081247-7a253efc2b0c
github.com/snyk/go-application-framework v0.0.0-20250212083751-0fa149ffbf72
github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65
github.com/snyk/snyk-iac-capture v0.6.5
github.com/snyk/snyk-ls v0.0.0-20250211120001-7122ee6defea
Expand Down
4 changes: 2 additions & 2 deletions cliv2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,8 @@ github.com/snyk/container-cli v0.0.0-20240821111304-7ca1c415a5d7 h1:Zn5BcV76oFAb
github.com/snyk/container-cli v0.0.0-20240821111304-7ca1c415a5d7/go.mod h1:38w+dcAQp9eG3P5t2eNS9eG0reut10AeJjLv5lJ5lpM=
github.com/snyk/error-catalog-golang-public v0.0.0-20250121101159-e6a61b2bfae6 h1:qY954YMn/7TaapgatD1bn4hfGQSmu56W6EgS2m8c++I=
github.com/snyk/error-catalog-golang-public v0.0.0-20250121101159-e6a61b2bfae6/go.mod h1:Ytttq7Pw4vOCu9NtRQaOeDU2dhBYUyNBe6kX4+nIIQ4=
github.com/snyk/go-application-framework v0.0.0-20250205081247-7a253efc2b0c h1:FAZ18Wx6iqz0w5N1CfEFq4sjL5MiMbjaCQX7ogFwDfw=
github.com/snyk/go-application-framework v0.0.0-20250205081247-7a253efc2b0c/go.mod h1:ag3sCoHGCn534oDAnAXLcjZEZljW3oMOfKCzpmFX060=
github.com/snyk/go-application-framework v0.0.0-20250212083751-0fa149ffbf72 h1:r/jEVadfrBHn8wFYWrE4qq4kBAYnD9p9s3GN/MtfqUo=
github.com/snyk/go-application-framework v0.0.0-20250212083751-0fa149ffbf72/go.mod h1:ag3sCoHGCn534oDAnAXLcjZEZljW3oMOfKCzpmFX060=
github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65 h1:CEQuYv0Go6MEyRCD3YjLYM2u3Oxkx8GpCpFBd4rUTUk=
github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65/go.mod h1:88KbbvGYlmLgee4OcQ19yr0bNpXpOr2kciOthaSzCAg=
github.com/snyk/policy-engine v0.33.0 h1:nXH4LEVrYbEuSEq4RJBObRY2fduaXiovAJt3Kni1baY=
Expand Down
22 changes: 21 additions & 1 deletion test/jest/acceptance/snyk-code/snyk-code.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ describe('snyk code test', () => {
}
});

it('with --severity-threashold', async () => {
it('with --severity-threshold', async () => {
const { stdout, stderr, code } = await runSnykCLI(
`code test ${pathToTest} --severity-threshold=high --sarif-file-output=${sarifFile}`,
{
Expand Down Expand Up @@ -670,6 +670,26 @@ describe('snyk code test', () => {
});
},
);

describe(`with ignored issues`, () => {
it('test a single file', async () => {
const { stderr, code } = await runSnykCLI(
`code test ${localPath}/routes/index.js --sarif-file-output=${sarifFile}`,
{
env: {
...process.env,
...integrationEnv,
},
},
);

expect(code).toBe(0);
expect(stderr).toBe('');

// Verify SARIF file
checkSarif(sarifFile, 4);
});
});
}
});
},
Expand Down

0 comments on commit 65b8011

Please sign in to comment.