Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(code): Support single file test for golang native implementation #5731

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 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-20250210203133-5b0f3252d77d
github.com/snyk/go-application-framework v0.0.0-20250212121528-2e787c13a2cc
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 Expand Up @@ -168,7 +168,7 @@ require (
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.3.0 // indirect
github.com/snyk/code-client-go v1.13.0 // indirect
github.com/snyk/code-client-go v1.13.1 // indirect
github.com/snyk/policy-engine v0.33.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/sourcegraph/go-lsp v0.0.0-20240223163137-f80c5dd31dfd // indirect
Expand Down
8 changes: 4 additions & 4 deletions cliv2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -772,14 +772,14 @@ github.com/snyk/cli-extension-iac-rules v0.0.0-20250121103856-ea5f31e53509 h1:4L
github.com/snyk/cli-extension-iac-rules v0.0.0-20250121103856-ea5f31e53509/go.mod h1:eaSq1kwY3uGF8bGVYDuv2E3AbzOlCRhdseGhKPvG4OM=
github.com/snyk/cli-extension-sbom v0.0.0-20241016065306-0df2be5b3b8f h1:dlL+f+5sjHj4JCzW/Evl1x9UREXLyc3M4KjoZvQx0Bs=
github.com/snyk/cli-extension-sbom v0.0.0-20241016065306-0df2be5b3b8f/go.mod h1:5CaY1bgvJY/uoG/1plLOf8T8o9AkwoBIGvw34RfRLZw=
github.com/snyk/code-client-go v1.13.0 h1:Hjlfdie7DbMvIDaDdCuY29Z9Z4isvFuAX+u3wevCjWA=
github.com/snyk/code-client-go v1.13.0/go.mod h1:jMRi+hf0T4472k390nGIM5/ZA7bufXlD72TBPmuWdVQ=
github.com/snyk/code-client-go v1.13.1 h1:JWQIrHOg/HYs0yqLmv1kNASwNhKXSYOcZsHU3QEugLk=
github.com/snyk/code-client-go v1.13.1/go.mod h1:jMRi+hf0T4472k390nGIM5/ZA7bufXlD72TBPmuWdVQ=
github.com/snyk/container-cli v0.0.0-20240821111304-7ca1c415a5d7 h1:Zn5BcV76oFAbJm5tDygU945lvoZ3yY8FoRFDC3YpwF8=
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-20250210203133-5b0f3252d77d h1:Qhe0N1em8naODCCTXU12UHC4Te9FgwYAS32pzyRIAi8=
github.com/snyk/go-application-framework v0.0.0-20250210203133-5b0f3252d77d/go.mod h1:ag3sCoHGCn534oDAnAXLcjZEZljW3oMOfKCzpmFX060=
github.com/snyk/go-application-framework v0.0.0-20250212121528-2e787c13a2cc h1:4+Dikq3mURoCWgAwK5JOXQbBppF7EfdF8a4Ev5M2ZOQ=
github.com/snyk/go-application-framework v0.0.0-20250212121528-2e787c13a2cc/go.mod h1:hqn5+hhsz17IC/BhsMcUQUKiyyb3txYzudu1mqs47Jo=
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
Loading