Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate trust-policies to jest
- Loading branch information
Jahed Ahmed
committed
Jul 19, 2021
1 parent
b227f78
commit e2106f1
Showing
2 changed files
with
41 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { createProject } from '../../util/createProject'; | ||
import { requireSnykToken } from '../../util/requireSnykToken'; | ||
import { runSnykCLI } from '../../util/runSnykCLI'; | ||
|
||
jest.setTimeout(1000 * 60); | ||
|
||
test('`snyk test` detects suggested ignore policies', async () => { | ||
const project = await createProject('qs-package'); | ||
const { code, stdout } = await runSnykCLI('test', { | ||
cwd: project.path(), | ||
env: { | ||
...process.env, | ||
SNYK_TOKEN: requireSnykToken(), | ||
}, | ||
}); | ||
|
||
expect(code).toEqual(1); | ||
expect(stdout).toMatch( | ||
'suggests ignoring this issue, with reason: test trust policies', | ||
); | ||
expect(stdout).toMatch('npm:hawk:20160119'); | ||
expect(stdout).toMatch('npm:request:20160119'); | ||
}); | ||
|
||
test('`snyk test --trust-policies` applies suggested ignore policies', async () => { | ||
const project = await createProject('qs-package'); | ||
const { code, stdout } = await runSnykCLI('test --trust-policies', { | ||
cwd: project.path(), | ||
env: { | ||
...process.env, | ||
SNYK_TOKEN: requireSnykToken(), | ||
}, | ||
}); | ||
|
||
expect(code).toEqual(1); | ||
expect(stdout).not.toMatch( | ||
'suggests ignoring this issue, with reason: test trust policies', | ||
); | ||
expect(stdout).not.toMatch('npm:hawk:20160119'); | ||
expect(stdout).not.toMatch('npm:request:20160119'); | ||
}); |
This file was deleted.
Oops, something went wrong.