performance icon indicating copy to clipboard operation
performance copied to clipboard

Improve Test Coverage for Webp-Uploads Plugin

Open sarthak-19 opened this issue 9 months ago • 5 comments

Summary

This is part of https://github.com/WordPress/performance/issues/1789:

  • Ignore Coverage for Non-Critical Code Blocks
  • Add Missing @covers Annotations
  • Add Missing Tests

sarthak-19 avatar Mar 18 '25 19:03 sarthak-19

I've ignored the deprecated functions from code coverage. Should these be removed completely or as of now should I ignore it only.

cc : @westonruter

sarthak-19 avatar Mar 18 '25 19:03 sarthak-19

@sarthak-19 good question. I'm not sure how deprecated they are.

@adamsilverstein are these on their way out or are they still important? I recall they were recently modified.

westonruter avatar Mar 18 '25 19:03 westonruter

Codecov Report

:x: Patch coverage is 69.23077% with 88 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 70.24%. Comparing base (8856a14) to head (50a9f72). :warning: Report is 144 commits behind head on trunk.

Files with missing lines Patch % Lines
plugins/webp-uploads/helper.php 69.23% 88 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #1946      +/-   ##
==========================================
+ Coverage   67.74%   70.24%   +2.50%     
==========================================
  Files          93       90       -3     
  Lines        7664     7620      -44     
==========================================
+ Hits         5192     5353     +161     
+ Misses       2472     2267     -205     
Flag Coverage Δ
multisite 70.24% <69.23%> (+2.50%) :arrow_up:
single 37.69% <68.18%> (+0.82%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Mar 18 '25 19:03 codecov[bot]

  1. The deprecated functions are not being used anywhere in webp-uploads plugin, so is it safe to assume that we can remove them?

  2. The coverage of this plugin as reported by codecov is suddenly dropped to 0%.

Ref : https://app.codecov.io/gh/WordPress/performance/pull/1946/tree/plugins/webp-uploads?dropdown=coverage

However when I'm generating the coverage report with modified changes in local env. I'm getting 80% coverage.

Codecov Local
image image

Any ideas why this might be happening?

cc : @westonruter

sarthak-19 avatar Mar 20 '25 19:03 sarthak-19

1. The deprecated functions are not being used anywhere in webp-uploads plugin, so is it safe to assume that we can remove them?

I see that too. I guess they can be removed, but they're already ignored from code coverage, so I think we can consider removal in another PR.

2. The coverage of this plugin as reported by codecov is suddenly dropped to 0%.

Sorry, I don't know. Maybe @ShyamGadde has an idea.

westonruter avatar Mar 21 '25 20:03 westonruter

This issue has been resolved, please close it admin

phanduynam avatar Apr 03 '25 13:04 phanduynam

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @[email protected].

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: [email protected].

Co-authored-by: sarthak-19 <[email protected]>
Co-authored-by: ShyamGadde <[email protected]>
Co-authored-by: westonruter <[email protected]>
Co-authored-by: phanduynam <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

github-actions[bot] avatar Jun 30 '25 10:06 github-actions[bot]