Skip to content

Commit

Permalink
raise coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
markis committed Feb 23, 2018
1 parent 4ac6fa2 commit 2ab8599
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,49 @@ describe('jest-ratchet', () => {
}));
});

it('will pad the ratchet percentages', () => {
const PADDING = 2;
const threshold = {
coverageThreshold: {
global: {
branches: 50,
},
},
};
fs.__addMockFile(
/\/coverage-summary\.json$/,
JSON.stringify({
total: {
branches: {pct: 100},
},
}),
);
fs.__addMockFile(
/\/package\.json$/,
JSON.stringify({ ...threshold }),
);

const jestRatchet = new JestRatchet({
...mockConfig,
...threshold,
rootDir: './example',
}, {
ratchetPercentagePadding: PADDING,
});
jestRatchet.onRunComplete();

const writeFileSync = fs.writeFileSync as jest.Mock;
expect(writeFileSync.mock.calls[0][1])
.toEqual(
JSON.stringify({
coverageThreshold: {
global: {
branches: 98,
},
},
}));
});

it('will respect the --config flag', () => {
process.argv = ['', '', '--config', 'jestconfig.json'];
const threshold = {
Expand Down

0 comments on commit 2ab8599

Please sign in to comment.