Skip to content

Commit e59e63a

Browse files
authored
Remove deprecatedCoverageDecreaseThreshold and fix typos. (#25)
Remove deprecatedCoverageDecreaseThreshold param. (Breaking change)
1 parent eda8392 commit e59e63a

File tree

6 files changed

+14
-24
lines changed

6 files changed

+14
-24
lines changed

src/__snapshots__/diffChecker.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`diffChecker coverage decreased over total treshold should match snapshot 1`] = `
3+
exports[`diffChecker coverage decreased over total threshold should match snapshot 1`] = `
44
Object {
55
"diff": Object {
66
"fileA": Object {

src/common.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ export interface IConfigOptions {
3030
/* Fail coverage check if per-file coverage is lower */
3131
coverageThreshold?: number;
3232
/* Fail coverage check if per-file coverage decrease is lower */
33-
/**
34-
* @deprecated use coverageDecreaseThreshold instead
35-
*/
36-
coverageDecreaseTreshold?: number;
3733
coverageDecreaseThreshold?: number;
3834
}
3935

src/diffChecker.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ describe('diffChecker', () => {
1919
expect(diffChecker(fileFullCovered, fileNotCovered)).toMatchSnapshot();
2020
});
2121
});
22-
describe('coverage decreased over total treshold', () => {
22+
describe('coverage decreased over total threshold', () => {
2323
let result: IDiffCheckResults;
2424
beforeEach(() => {
25-
// Set coverageDecreaseThreshold to 100% so we only test coverageTreshold.
25+
// Set coverageDecreaseThreshold to 100% so we only test coverageThreshold.
2626
result = diffChecker(
2727
fileFullCovered,
2828
fileHalfCovered,
@@ -67,7 +67,7 @@ describe('diffChecker', () => {
6767
});
6868
describe('total decreased', () => {
6969
it('should not regress', () => {
70-
// Set coverageTreshold to 0 as we have a new file half covered.
70+
// Set coverageThreshold to 0 as we have a new file half covered.
7171
expect(
7272
diffChecker(
7373
fileFullCovered,

src/diffChecker.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const diffChecker = (
2828
const nonZeroTest = (x: number) => x !== 0;
2929
const coverageDecreased = (x: number) =>
3030
x < 0 ? Math.abs(x) >= coverageDecreaseThreshold : false;
31-
const isBelowTreshold = (x: number) => x < coverageThreshold;
31+
const isBelowThreshold = (x: number) => x < coverageThreshold;
3232

3333
diffMap.forEach((v, k) => {
3434
const diffPercentages = getSummaryPercentages(v);
@@ -40,15 +40,15 @@ export const diffChecker = (
4040
checkCriteria,
4141
coverageDecreased
4242
);
43-
const belowTreshold = checkCoverageForCondition(
43+
const belowThreshold = checkCoverageForCondition(
4444
head[k],
4545
checkCriteria,
46-
isBelowTreshold
46+
isBelowThreshold
4747
);
4848

49-
// Coverage decreased on a file or under treshold, regress.
49+
// Coverage decreased on a file or under threshold, regress.
5050
// Ignore the total field as we check only files.
51-
if ((decreased || belowTreshold) && k !== 'total') {
51+
if ((decreased || belowThreshold) && k !== 'total') {
5252
regression = true;
5353
}
5454

src/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('diff', () => {
6666
const mockedOptions: IConfigOptions = {
6767
checkCriteria: ['lines'],
6868
coverageThreshold: 100,
69-
coverageDecreaseTreshold: 0
69+
coverageDecreaseThreshold: 0
7070
};
7171

7272
coverageDiff.diff(fileNotCovered, fileFullCovered, mockedOptions);
@@ -76,7 +76,7 @@ describe('diff', () => {
7676
fileFullCovered,
7777
mockedOptions.checkCriteria,
7878
mockedOptions.coverageThreshold,
79-
mockedOptions.coverageDecreaseTreshold
79+
mockedOptions.coverageDecreaseThreshold
8080
);
8181
});
8282
});

src/index.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,15 @@ export function diff(
1717
head: IJsonSummary,
1818
options = defaultOptions
1919
): ICoverageDiffOutput {
20-
const {
21-
checkCriteria,
22-
coverageThreshold,
23-
coverageDecreaseThreshold,
24-
coverageDecreaseTreshold: deprecatedCoverageDecreaseThreshold
25-
} = options;
20+
const { checkCriteria, coverageThreshold, coverageDecreaseThreshold } =
21+
options;
2622

2723
const { regression, files, totals, diff } = diffChecker(
2824
base,
2925
head,
3026
checkCriteria,
3127
coverageThreshold,
32-
coverageDecreaseThreshold !== undefined
33-
? coverageDecreaseThreshold
34-
: deprecatedCoverageDecreaseThreshold
28+
coverageDecreaseThreshold
3529
);
3630

3731
const results = resultFormatter(files, totals);

0 commit comments

Comments
 (0)