Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 2, 2019
1 parent bd18bb2 commit ab389b3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
32 changes: 20 additions & 12 deletions e2e/__tests__/coverageThreshold.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ test('exits with 1 if coverage threshold is not met', () => {
'package.json': JSON.stringify(pkgJson, null, 2),
});

const {stdout, stderr, exitCode} = runJest(DIR, ['--coverage', '--ci=false'], {
stripAnsi: true,
});
const {stdout, stderr, exitCode} = runJest(
DIR,
['--coverage', '--ci=false'],
{stripAnsi: true},
);
const {rest, summary} = extractSummary(stderr);

expect(exitCode).toBe(1);
Expand Down Expand Up @@ -78,9 +80,11 @@ test('exits with 1 if path threshold group is not found in coverage data', () =>
'package.json': JSON.stringify(pkgJson, null, 2),
});

const {stdout, stderr, exitCode} = runJest(DIR, ['--coverage', '--ci=false'], {
stripAnsi: true,
});
const {stdout, stderr, exitCode} = runJest(
DIR,
['--coverage', '--ci=false'],
{stripAnsi: true},
);
const {rest, summary} = extractSummary(stderr);

expect(exitCode).toBe(1);
Expand Down Expand Up @@ -160,9 +164,11 @@ test('excludes tests matched by path threshold groups from global group', () =>
'package.json': JSON.stringify(pkgJson, null, 2),
});

const {stdout, stderr, exitCode} = runJest(DIR, ['--coverage', '--ci=false'], {
stripAnsi: true,
});
const {stdout, stderr, exitCode} = runJest(
DIR,
['--coverage', '--ci=false'],
{stripAnsi: true},
);
const {rest, summary} = extractSummary(stderr);

expect(exitCode).toBe(1);
Expand Down Expand Up @@ -203,9 +209,11 @@ test('file is matched by all path and glob threshold groups', () => {
'package.json': JSON.stringify(pkgJson, null, 2),
});

const {stdout, stderr, exitCode} = runJest(DIR, ['--coverage', '--ci=false'], {
stripAnsi: true,
});
const {stdout, stderr, exitCode} = runJest(
DIR,
['--coverage', '--ci=false'],
{stripAnsi: true},
);
const {rest, summary} = extractSummary(
/* This test also runs on windows and when the glob fails it outputs
the system specific absolute path to the test file. */
Expand Down
16 changes: 12 additions & 4 deletions e2e/__tests__/mockNames.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,36 @@ test('suite without mock name, mock not called', () => {
});

test('suite with mock name, expect mock not called', () => {
const {stderr, exitCode} = runJest('mock-names/with-mock-name-not-called-pass');
const {stderr, exitCode} = runJest(
'mock-names/with-mock-name-not-called-pass',
);

expect(exitCode).toBe(0);
expect(stderr).toMatch(/PASS/);
});

test('suite with mock name, mock called, expect fail', () => {
const {stderr, exitCode} = runJest('mock-names/with-mock-name-not-called-fail');
const {stderr, exitCode} = runJest(
'mock-names/with-mock-name-not-called-fail',
);

expect(exitCode).toBe(1);
expect(stderr).toMatch(/expect\(myMockedFunction\)\.not\.toHaveBeenCalled/);
});

test('suite with mock name, mock called 5 times', () => {
const {stderr, exitCode} = runJest('mock-names/with-mock-name-call-times-pass');
const {stderr, exitCode} = runJest(
'mock-names/with-mock-name-call-times-pass',
);

expect(exitCode).toBe(0);
expect(stderr).toMatch(/PASS/);
});

test('suite with mock name, mock not called 5 times, expect fail', () => {
const {stderr, exitCode} = runJest('mock-names/with-mock-name-call-times-fail');
const {stderr, exitCode} = runJest(
'mock-names/with-mock-name-call-times-fail',
);

expect(exitCode).toBe(1);
expect(stderr).toMatch(/expect\(myMockedFunction\)\.toHaveBeenCalledTimes/);
Expand Down

0 comments on commit ab389b3

Please sign in to comment.