Skip to content

Commit

Permalink
fix: problem with non existing base file
Browse files Browse the repository at this point in the history
  • Loading branch information
HolyNoodle committed Sep 25, 2023
1 parent e3c77c1 commit 410c7f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
19 changes: 5 additions & 14 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 5 additions & 15 deletions src/coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function computeCoverage(
core.debug('BRANCH:\n' + JSON.stringify(branch))

const computeCoverage = (
base: CoverageInfo,
base: CoverageInfo = { total: 0, covered: 0, skipped: 0, pct: 0 },
branch: CoverageInfo
): ExtendedCoverageInfo => {
return {
Expand All @@ -98,21 +98,11 @@ export async function computeCoverage(
base: Coverage | undefined,
branch: Coverage
): Coverage => {
// Added file
if (!base) {
return {
branches: branch.branches,
functions: branch.functions,
lines: branch.lines,
statements: branch.statements
}
}

return {
branches: computeCoverage(base.branches, branch.branches),
functions: computeCoverage(base.functions, branch.functions),
lines: computeCoverage(base.lines, branch.lines),
statements: computeCoverage(base.statements, branch.statements)
branches: computeCoverage(base?.branches, branch.branches),
functions: computeCoverage(base?.functions, branch.functions),
lines: computeCoverage(base?.lines, branch.lines),
statements: computeCoverage(base?.statements, branch.statements)
}
}

Expand Down

0 comments on commit 410c7f0

Please sign in to comment.