|
| 1 | +import { createProject } from '../../util/createProject'; |
| 2 | +import { requireSnykToken } from '../../util/requireSnykToken'; |
| 3 | +import { runSnykCLI } from '../../util/runSnykCLI'; |
| 4 | + |
| 5 | +jest.setTimeout(1000 * 60); |
| 6 | + |
| 7 | +test('`snyk test` detects suggested ignore policies', async () => { |
| 8 | + const project = await createProject('qs-package'); |
| 9 | + const { code, stdout } = await runSnykCLI('test', { |
| 10 | + cwd: project.path(), |
| 11 | + env: { |
| 12 | + ...process.env, |
| 13 | + SNYK_TOKEN: requireSnykToken(), |
| 14 | + }, |
| 15 | + }); |
| 16 | + |
| 17 | + expect(code).toEqual(1); |
| 18 | + expect(stdout).toMatch( |
| 19 | + 'suggests ignoring this issue, with reason: test trust policies', |
| 20 | + ); |
| 21 | + expect(stdout).toMatch('npm:hawk:20160119'); |
| 22 | + expect(stdout).toMatch('npm:request:20160119'); |
| 23 | +}); |
| 24 | + |
| 25 | +test('`snyk test --trust-policies` applies suggested ignore policies', async () => { |
| 26 | + const project = await createProject('qs-package'); |
| 27 | + const { code, stdout } = await runSnykCLI('test --trust-policies', { |
| 28 | + cwd: project.path(), |
| 29 | + env: { |
| 30 | + ...process.env, |
| 31 | + SNYK_TOKEN: requireSnykToken(), |
| 32 | + }, |
| 33 | + }); |
| 34 | + |
| 35 | + expect(code).toEqual(1); |
| 36 | + expect(stdout).not.toMatch( |
| 37 | + 'suggests ignoring this issue, with reason: test trust policies', |
| 38 | + ); |
| 39 | + expect(stdout).not.toMatch('npm:hawk:20160119'); |
| 40 | + expect(stdout).not.toMatch('npm:request:20160119'); |
| 41 | +}); |
0 commit comments