Skip to content

Commit

Permalink
test: migrate trust-policies to jest
Browse files Browse the repository at this point in the history
  • Loading branch information
Jahed Ahmed committed Jul 19, 2021
1 parent b227f78 commit e2106f1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 38 deletions.
41 changes: 41 additions & 0 deletions test/jest/acceptance/snyk-test/trust-policies.spec.ts
@@ -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');
});
38 changes: 0 additions & 38 deletions test/policy-trust-deep.test.ts

This file was deleted.

0 comments on commit e2106f1

Please sign in to comment.