Skip to content

Commit

Permalink
Merge pull request #2160 from snyk/test/flakey-test-232
Browse files Browse the repository at this point in the history
test: use common test setup
  • Loading branch information
Jahed Ahmed committed Aug 12, 2021
2 parents a898dfb + 25b201c commit 271a052
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 27 deletions.
15 changes: 10 additions & 5 deletions test/jest/acceptance/snyk-test-all-projects-exit-codes.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { createCLITestHarness } from '../util/snyk-cli-test-harness';
import { createProject } from '../util/createProject';
import { runSnykCLI } from '../util/runSnykCLI';

jest.setTimeout(1000 * 60 * 5);

describe('snyk test -all-projects with one project that has errors', () => {
describe('and another that has issues (vulnerabilities)', () => {
it('should exit with exit code 1', async () => {
const test = createCLITestHarness(
const project = await createProject(
'snyk-test-all-projects-exit-codes/project-with-issues-and-project-with-error',
);
const { code, stderr } = await test.test();
const { code, stderr } = await runSnykCLI(`test --all-projects`, {
cwd: project.path(),
});
expect(code).toEqual(1);
expect(stderr).toContain(
'1/2 potential projects failed to get dependencies. Run with `-d` for debug output.',
Expand All @@ -19,10 +22,12 @@ describe('snyk test -all-projects with one project that has errors', () => {
describe('and another has no issues (vulnerabilities)', () => {
// note: actually, this is a bug. It should really have exit code 2, but that is a big change that we need to do
it('should exit with exit code 0', async () => {
const test = createCLITestHarness(
const project = await createProject(
'snyk-test-all-projects-exit-codes/project-with-no-issues-and-project-with-error',
);
const { code, stderr } = await test.test();
const { code, stderr } = await runSnykCLI(`test --all-projects`, {
cwd: project.path(),
});
expect(code).toEqual(0);
expect(stderr).toContain(
'1/2 potential projects failed to get dependencies. Run with `-d` for debug output.',
Expand Down
22 changes: 0 additions & 22 deletions test/jest/util/snyk-cli-test-harness.ts

This file was deleted.

0 comments on commit 271a052

Please sign in to comment.