Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add trend indicator #323

Merged
merged 7 commits into from
Feb 26, 2024
Merged

feat: Add trend indicator #323

merged 7 commits into from
Feb 26, 2024

Conversation

davelosert
Copy link
Owner

This pull request primarily focuses on enhancing the functionality of the coverage reporting system. The changes include the addition of a new json-summary-compare-path option to compare coverage summaries, modifications to the README.md and action.yml files to reflect this new option, and several file relocations and renames to improve code organization.

Fixes #262.

Here are the top five most important changes:

Changes to reporting options:

  • README.md: A new option json-summary-compare-path was added to the options table. This option allows users to specify a path to a json summary file to compare against the current run, providing a trend indicator and the difference in the summary.
  • action.yml: The file-coverage-mode option was moved and the json-summary-compare-path option was added. This new option requires a path to the json summary file of the previous run to get trend indicators.

Code organization and simplification:

  • Several files were moved from the src directory to the src/inputs and src/report directories. This change improves the organization of the code by grouping related files together. [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • src/index.ts: The import statements were reordered, and new code was added to handle the jsonSummaryComparePath option. If this option is provided, the json summary file at the given path is parsed and used to generate the summary table.

Changes to coverage reporting:

  • src/report/generateSummaryTableHtml.test.ts: New tests were added to check the generation of the summary table when a compare report is provided. These tests check the cases where the coverage increased, decreased, or stayed the same.

Copy link
Contributor

github-actions bot commented Dec 23, 2023

Coverage Report for Mock Reports (./test/mockReports)

Status Category Percentage Covered / Total
🔵 Lines 41.37% 60 / 145
🔵 Statements 41.33% 62 / 150
🔵 Functions 62.06% 18 / 29
🔵 Branches 39.65% 23 / 58
File CoverageNo changed files found.
Generated in workflow #646

Copy link
Contributor

github-actions bot commented Dec 23, 2023

Coverage Report for Root

Status Category Percentage Covered / Total
🔵 Lines 53.68% 422 / 786
🔵 Statements 53.68% 422 / 786
🔵 Functions 75% 15 / 20
🔵 Branches 91.13% 72 / 79
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/icons.ts 100% 100% 100% 100%
src/index.ts 0% 0% 0% 0% 1-87
src/report/generateSummaryTableHtml.ts 100% 100% 100% 100%
Unchanged Files
src/writeSummaryToPR.ts 0% 0% 0% 0% 1-124
src/inputs/FileCoverageMode.ts 100% 100% 100% 100%
src/inputs/getPullChanges.ts 0% 0% 0% 0% 1-58
src/inputs/getViteConfigPath.ts 98.03% 87.5% 100% 98.03% 39
src/inputs/options.ts 0% 0% 0% 0% 1-43
src/inputs/parseCoverageThresholds.ts 100% 100% 100% 100%
src/inputs/parseJsonReports.ts 0% 0% 0% 0% 1-50
src/report/generateFileCoverageHtml.ts 100% 100% 100% 100%
src/report/generateFileUrl.ts 94.44% 50% 100% 94.44% 6
src/report/generateHeadline.ts 100% 100% 100% 100%
src/report/getUncoveredLinesFromStatements.ts 100% 100% 100% 100%
Generated in workflow #646

@inomn
Copy link

inomn commented Jan 21, 2024

hi @davelosert ! Thanks for the effort. Any estimates on this feature?

@davelosert
Copy link
Owner Author

Hi @inomn,

this feature is basically ready.

What kept me from merging yet is that in it's current form, it requires users's to manually generate both JSON-Reports.

I wanted to add another convenience function to automatically download the latest report from the target-branch in order to avoid having to run tests twice during the PR.

I hoped I could do this during the christmas-break, but unfortunately wasn't able to finish and pick up the work.

I'll see if I can finish it up this week and merge this.

@inomn
Copy link

inomn commented Feb 23, 2024

Hi @davelosert ! Sorry bothering you, any estimates on this feature? Thanks!

@davelosert davelosert merged commit 698d54e into main Feb 26, 2024
3 checks passed
@davelosert davelosert deleted the add-trend-indicator branch February 26, 2024 19:27
github-actions bot pushed a commit that referenced this pull request Feb 26, 2024
# [2.3.0](v2.2.1...v2.3.0) (2024-02-26)

### Features

* Add trend indicator ([#323](#323)) ([698d54e](698d54e))
Copy link
Contributor

🎉 This PR is included in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@davelosert
Copy link
Owner Author

@inomn : Sorry, that took longer than expected, but I just released the initial version of this feature. Here is the documentation on how to use it.

I am still planning to include a feature that will allow you to simply download the latest summary-compare-json automatically from the target branch - but I am not sure when I will be able to do that, and I no longer wanted to keep you waiting.

Happy to hear feedback about the feature and how it can be improved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display Trend indicator
2 participants