Skip to content

Exclude bin/ directory from code coverage#355

Open
kraftbj wants to merge 2 commits intotrunkfrom
chore/ignore-bin-codecov
Open

Exclude bin/ directory from code coverage#355
kraftbj wants to merge 2 commits intotrunkfrom
chore/ignore-bin-codecov

Conversation

@kraftbj
Copy link
Copy Markdown
Contributor

@kraftbj kraftbj commented Jan 14, 2026

Summary

  • Excludes the bin/ directory from Codecov coverage calculations

The bin/ directory contains CLI and infrastructure scripts that make HTTP requests to external APIs (GitHub REST/GraphQL). These are integration scripts that are inherently difficult to unit test without extensive HTTP mocking.

See #354 as an example - the codecov/patch check passes (confirming the testable parsing logic has coverage), but codecov/project fails because the CLI orchestration code in bin/ isn't covered.

Test plan

  • Verify Codecov no longer counts bin/ files toward project coverage

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 14, 2026

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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props kraftbj, bernhard-reiter.

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

@kraftbj kraftbj self-assigned this Jan 14, 2026
@kraftbj kraftbj requested a review from priethor January 14, 2026 16:11
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.65%. Comparing base (9becdab) to head (ad698ca).
⚠️ Report is 1 commits behind head on trunk.

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #355      +/-   ##
============================================
- Coverage     53.84%   52.65%   -1.20%     
  Complexity     4423     4423              
============================================
  Files           298      298              
  Lines         39468    39468              
============================================
- Hits          21251    20780     -471     
- Misses        18217    18688     +471     
Flag Coverage Δ
e2e-js 45.84% <ø> (-0.02%) ⬇️
e2e-php 40.36% <ø> (-2.01%) ⬇️
javascript 15.07% <ø> (ø)
phpunit 29.95% <ø> (ø)

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.

@ockham
Copy link
Copy Markdown
Contributor

ockham commented Jan 22, 2026

See #354 as an example - the codecov/patch check passes (confirming the testable parsing logic has coverage), but codecov/project fails because the CLI orchestration code in bin/ isn't covered.

Seems to be passing now though for that PR?

image

@kraftbj
Copy link
Copy Markdown
Contributor Author

kraftbj commented Jan 22, 2026

Yeah, the last commit apparently changed the coverage so it wouldn't fail. Here's an example of the run where it did fail https://github.com/WordPress/secure-custom-fields/runs/60370170867

I'm not exactly sure why it differed so much between those two commits.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Codecov configuration to exclude the repository’s bin/ directory (CLI/infrastructure scripts) from coverage calculations, so overall project coverage reflects unit-testable application code rather than integration-oriented orchestration scripts.

Changes:

  • Add bin/ to the ignore: list in .codecov.yml to remove it from Codecov project coverage totals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- '*.min.css'
- '*.min.js'
- '.wp-env'
- 'bin/' # CLI/infrastructure scripts - integration code with external APIs
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

The ignore list uses bare directory names (e.g., 'build', 'dist', 'docs') without a trailing slash. For consistency and to avoid any pattern-matching edge cases, consider changing 'bin/' to match the existing style (e.g., 'bin' or an explicit glob like 'bin/**').

Suggested change
- 'bin/' # CLI/infrastructure scripts - integration code with external APIs
- 'bin' # CLI/infrastructure scripts - integration code with external APIs

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants