Skip to content

Commit

Permalink
fix: summary table and head indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdevpereira committed Oct 8, 2022
1 parent b34dc41 commit 996fa22
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/utils/buildComment.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ function BuildCommentBody({
const timeTaken = CalculateTimeTaken(testResults.startTime, testResults.testResults[testResults.testResults.length - 1].endTime);

const commentBody = `## 🔖 Coverage Report
${coverageMessage}
${coverageSummaryTable}
${coverageMessage}
${coverageSummaryTable}
<details>
<summary>Metrics</summary>
- Test Suites: **${testResults.numPassedTestSuites} passed**, ${testResults.numTotalTestSuites} total
- Tests: **${testResults.numPassedTests} passed**, ${testResults.numTotalTests} total
- Snapshots: **${testResults.snapshot.total} total**
- Time: **${timeTaken}**
<summary>Metrics</summary>
- Test Suites: **${testResults.numPassedTestSuites} passed**, ${testResults.numTotalTestSuites} total
- Tests: **${testResults.numPassedTests} passed**, ${testResults.numTotalTests} total
- Snapshots: **${testResults.snapshot.total} total**
- Time: **${timeTaken}**
</details>
> Coverage data is based on head **${branchName}** (\`${headShortHash, baseShortHash}\`) compared to base **${baseRef}** (\`${baseShortHash}\`).
Expand All @@ -45,15 +46,15 @@ function BuildCommentHeadMessage({
let coverageMessage;

if (headAvgPercentage > baseAvgPercentage) {
coverageMessage = `\n> Wooo 🎉, the tests are passing and the coverage percentage **increased**, well done! 👏\n> ${
coverageMessage = `> Wooo 🎉, the tests are passing and the coverage percentage **increased**, well done! 👏\n> ${
baseRef
}: **${Math.round(baseAvgPercentage, -1)}%** | ${
branchName
}: **${Math.round(headAvgPercentage, -1)}%**`;
} else if (headAvgPercentage === baseAvgPercentage) {
coverageMessage = '\n> Good job 👌, the tests are passing and the coverage percentage remained intact.';
coverageMessage = '> Good job 👌, the tests are passing and the coverage percentage remained intact.';
} else {
coverageMessage = `\n> Tests are passing but the coverage percentage **decreased** 😱, read coverage report below for more details.\n\n🔻 ${
coverageMessage = `> Tests are passing but the coverage percentage **decreased** 😱, read coverage report below for more details.\n\n🔻 ${
baseRef
}: **${Math.round(baseAvgPercentage, -1)}%** | ${
branchName
Expand Down

0 comments on commit 996fa22

Please sign in to comment.