Skip to content

Commit

Permalink
Updated coverage thresholds (#23)
Browse files Browse the repository at this point in the history
* Updated coverage thresholdholds

* Fixed total calculation
  • Loading branch information
bibipkins authored Mar 2, 2023
1 parent cb1fece commit 619ac8c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
comment-title: Test Coverage OpenCover
results-path: ./files/success/
coverage-path: ./files/success/test_coverage_opencover.xml
coverage-threshold: 46
coverage-threshold: 44
- name: Test Coverage Cobertura
uses: ./
with:
Expand All @@ -52,4 +52,4 @@ jobs:
results-path: ./files/success
coverage-path: ./files/success/test_coverage_cobertura.xml
coverage-type: cobertura
coverage-threshold: 46
coverage-threshold: 44
6 changes: 3 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ const common_1 = __nccwpck_require__(9023);
const parseCobertura = (filePath, threshold) => __awaiter(void 0, void 0, void 0, function* () { return (0, common_1.parseCoverage)(filePath, threshold, parseSummary, parseModules); });
const parseSummary = (file) => {
const summary = file.coverage['$'];
const totalCoverage = (0, common_1.calculateCoverage)(summary['lines-covered'] + summary['branches-covered'], summary['lines-valid'] + summary['branches-valid']);
const totalCoverage = (0, common_1.calculateCoverage)(Number(summary['lines-covered']) + Number(summary['branches-covered']), Number(summary['lines-valid']) + Number(summary['branches-valid']));
return {
totalCoverage,
linesTotal: Number(summary['lines-valid']),
Expand Down Expand Up @@ -370,7 +370,7 @@ const calculateCoverage = (covered, total) => {
exports.calculateCoverage = calculateCoverage;
const createCoverageModule = (name, threshold, files) => {
const total = files.reduce((summ, file) => summ + file.linesTotal + file.branchesTotal, 0);
const covered = files.reduce((summ, file) => summ + file.linesCovered + file.linesCovered, 0);
const covered = files.reduce((summ, file) => summ + file.linesCovered + file.branchesCovered, 0);
const coverage = (0, exports.calculateCoverage)(covered, total);
const success = !threshold || coverage >= threshold;
const updatedFiles = files
Expand Down Expand Up @@ -413,7 +413,7 @@ const common_1 = __nccwpck_require__(9023);
const parseOpencover = (filePath, threshold) => __awaiter(void 0, void 0, void 0, function* () { return (0, common_1.parseCoverage)(filePath, threshold, parseSummary, parseModules); });
const parseSummary = (file) => {
const summary = file.CoverageSession.Summary[0]['$'];
const totalCoverage = (0, common_1.calculateCoverage)(summary.visitedSequencePoints + summary.visitedBranchPoints, summary.numSequencePoints + summary.numBranchPoints);
const totalCoverage = (0, common_1.calculateCoverage)(Number(summary.visitedSequencePoints) + Number(summary.visitedBranchPoints), Number(summary.numSequencePoints) + Number(summary.numBranchPoints));
return {
totalCoverage,
linesTotal: Number(summary.numSequencePoints),
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/parsers/cobertura.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const parseCobertura: CoverageParser = async (filePath: string, threshold: numbe
const parseSummary = (file: any): ICoverageData => {
const summary = file.coverage['$'];
const totalCoverage = calculateCoverage(
summary['lines-covered'] + summary['branches-covered'],
summary['lines-valid'] + summary['branches-valid']
Number(summary['lines-covered']) + Number(summary['branches-covered']),
Number(summary['lines-valid']) + Number(summary['branches-valid'])
);

return {
Expand Down
4 changes: 2 additions & 2 deletions src/parsers/opencover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const parseOpencover: CoverageParser = async (filePath: string, threshold: numbe
const parseSummary = (file: any): ICoverageData => {
const summary = file.CoverageSession.Summary[0]['$'];
const totalCoverage = calculateCoverage(
summary.visitedSequencePoints + summary.visitedBranchPoints,
summary.numSequencePoints + summary.numBranchPoints
Number(summary.visitedSequencePoints) + Number(summary.visitedBranchPoints),
Number(summary.numSequencePoints) + Number(summary.numBranchPoints)
);

return {
Expand Down

0 comments on commit 619ac8c

Please sign in to comment.