Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
zuki-linB committed Jul 25, 2023
1 parent 2876f47 commit f46deee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
11 changes: 9 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2046,11 +2046,18 @@ function run() {
child_process_1.execSync(commandToRun);
const codeCoverageNew = (JSON.parse(fs_1.default.readFileSync(codeCoverageDirectory).toString()));
const codeCoverageOld = (JSON.parse(fs_1.default.readFileSync(mainBranchCoverageSummaryFileName).toString()));
console.log({ codeCoverageNew, codeCoverageOld });
const resolvedCodeCoverageOld = Object.entries(codeCoverageOld).reduce(
// @ts-ignore
([key, value], acc) => {
if (codeCoverageNew[key]) {
acc[key] = value;
}
return acc;
}, {});
const currentDirectory = child_process_1.execSync('pwd')
.toString()
.trim();
const diffChecker = new DiffChecker_1.DiffChecker(codeCoverageNew, codeCoverageOld);
const diffChecker = new DiffChecker_1.DiffChecker(codeCoverageNew, resolvedCodeCoverageOld);
let messageToPost = `## Test coverage results :test_tube: \n
Code coverage diff between base branch:${branchNameBase} and head branch: ${branchNameHead} \n\n`;
const coverageDetails = diffChecker.getCoverageDetails(!fullCoverage, `${currentDirectory}/`);
Expand Down
13 changes: 11 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,22 @@ async function run(): Promise<void> {
const codeCoverageOld = <CoverageReport>(
JSON.parse(fs.readFileSync(mainBranchCoverageSummaryFileName).toString())
)
console.log({codeCoverageNew, codeCoverageOld})
const resolvedCodeCoverageOld = Object.entries(codeCoverageOld).reduce(
// @ts-ignore
([key, value], acc) => {
if (codeCoverageNew[key]) {
acc[key] = value
}
return acc
},
{}
)
const currentDirectory = execSync('pwd')
.toString()
.trim()
const diffChecker: DiffChecker = new DiffChecker(
codeCoverageNew,
codeCoverageOld
resolvedCodeCoverageOld
)
let messageToPost = `## Test coverage results :test_tube: \n
Code coverage diff between base branch:${branchNameBase} and head branch: ${branchNameHead} \n\n`
Expand Down

0 comments on commit f46deee

Please sign in to comment.