Skip to content

[Issue]: Add Pester code coverage on main branch pushes for Codecov baseline #249

@WilliamBerryiii

Description

@WilliamBerryiii

Issue Description

Codecov cannot compare PR coverage against the base branch because no code coverage is generated when commits merge to main. This results in warnings like:

⚠️ There is no BASE report for this PR. The following commits on main have no coverage data.

Current behavior:

  • pr-validation.yml calls pester-tests.yml with code-coverage: true on pull requests
  • main.yml runs on push to main but does not include Pester tests or coverage reporting
  • Codecov has no baseline to compare against for coverage diff calculations
  • No Codecov configuration exists for status thresholds, carryforward flags, or ignore paths

Expected behavior:
Pushes to main should generate and upload code coverage to Codecov, establishing a baseline for PR comparisons. Codecov should be configured with appropriate thresholds and flags.

Proposed solution

1. Add pester-tests job to main.yml

pester-tests:
  name: PowerShell Tests
  uses: ./.github/workflows/pester-tests.yml
  permissions:
    contents: read
    id-token: write
  with:
    soft-fail: false
    changed-files-only: false
    code-coverage: true

2. Add codecov.yml configuration

Create a codecov.yml at the repository root with:

  • Status thresholds: Use target: auto to compare against base branch, allow 1% threshold for project status
  • Patch coverage: Set informational patch status to encourage good coverage on new code without blocking PRs
  • Carryforward flags: Enable carryforward: true on the pester flag to preserve coverage when tests don't run
  • Ignore paths: Exclude test code and logs directories from coverage calculations
  • PR comments: Configure to only comment when coverage changes
coverage:
  status:
    project:
      default:
        target: auto
        threshold: 1%
    patch:
      default:
        target: 80%
        informational: true

ignore:
  - "scripts/tests/**"
  - "logs/**"

comment:
  layout: "reach,diff,flags,files"
  behavior: default
  require_changes: true

flags:
  pester:
    paths:
      - "scripts/**"
    carryforward: true

Additional Context

Metadata

Metadata

Labels

needs-triageRequires triage and prioritization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions