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

Implement quick wins to fix code coverage in Image Prioritizer and Embed Optimizer #1945

Merged
merged 3 commits into from
Mar 20, 2025

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Mar 18, 2025

  • Add missing @covers
  • Extend // @codeCoverageIgnoreEnd in hooks.php.
  • Add missing @access private tags to the functions in Embed Optimizer.

Note the large diff in Embed Optimizer is just moving the functions out of hooks.php to be placed in helpers.php which follows the pattern used by other plugins.

See #1789

@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature [Plugin] Embed Optimizer Issues for the Embed Optimizer plugin (formerly Auto Sizes) skip changelog PRs that should not be mentioned in changelogs [Plugin] Image Prioritizer Issues for the Image Prioritizer plugin (dependent on Optimization Detective) labels Mar 18, 2025
@westonruter westonruter added this to the embed-optimizer n.e.x.t milestone Mar 18, 2025
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

Attention: Patch coverage is 54.85437% with 93 lines in your changes missing coverage. Please review.

Project coverage is 72.37%. Comparing base (3d03c16) to head (0149621).
Report is 12 commits behind head on trunk.

Files with missing lines Patch % Lines
plugins/embed-optimizer/helper.php 55.12% 92 Missing ⚠️
plugins/embed-optimizer/load.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #1945      +/-   ##
==========================================
+ Coverage   71.08%   72.37%   +1.29%     
==========================================
  Files          86       85       -1     
  Lines        6969     6998      +29     
==========================================
+ Hits         4954     5065     +111     
+ Misses       2015     1933      -82     
Flag Coverage Δ
multisite 72.37% <54.85%> (+1.29%) ⬆️
single 40.72% <44.17%> (+0.16%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Copy link

github-actions bot commented Mar 18, 2025

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.

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

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

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

@westonruter westonruter requested a review from sarthak-19 March 18, 2025 19:16
Copy link
Contributor

@sarthak-19 sarthak-19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !!

However just a small concern,
Coverage of Image Prioritizer seems to be improved a little, now at 89%
but embed-optimizer remained at 67%.
Maybe because of missing unit test cases.
If that's the case then the code refactoring part of embed optimizer along with new test cases should ideally be in another PR ?
Just a suggestion 🙇🏻

Ref : https://app.codecov.io/gh/WordPress/performance/pull/1945/tree/plugins

@westonruter
Copy link
Member Author

@sarthak-19 Thanks for checking. Yes, it's expected that Embed Optimizer would barely have any improvement since there was barely any change. So yes, let's follow up with another PR to add the tests for the functions that exist in helper.php.

@westonruter westonruter merged commit 04f8b04 into trunk Mar 20, 2025
18 checks passed
@westonruter westonruter deleted the fix/image-prioritizer-code-coverage branch March 20, 2025 19:11
@sarthak-19
Copy link
Contributor

Sure thing !! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Embed Optimizer Issues for the Embed Optimizer plugin (formerly Auto Sizes) [Plugin] Image Prioritizer Issues for the Image Prioritizer plugin (dependent on Optimization Detective) skip changelog PRs that should not be mentioned in changelogs [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants