-
Notifications
You must be signed in to change notification settings - Fork 125
Closed
Labels
enhancementNew feature or requestNew feature or requestworkflowsGitHub Actions workflowsGitHub Actions workflows
Description
Summary
Add code coverage reporting to the Pester testing workflow, tracking coverage metrics over time.
Parent Issue: #190
Note: This is a stretch goal / future enhancement. Implement after core testing is established.
Requirements
- Configure Pester to generate JaCoCo XML coverage reports
- Upload coverage reports as workflow artifacts
- Optionally integrate with coverage tracking service (Codecov, Coveralls)
- Establish baseline coverage thresholds
Implementation Details
Pester Coverage Configuration
# In pester.config.ps1
$config = New-PesterConfiguration
$config.CodeCoverage.Enabled = $true
$config.CodeCoverage.OutputFormat = 'JaCoCo'
$config.CodeCoverage.OutputPath = 'logs/coverage.xml'
$config.CodeCoverage.Path = @(
'./scripts/linting/*.ps1'
'./scripts/linting/Modules/*.psm1'
'./scripts/security/*.ps1'
'./scripts/dev-tools/*.ps1'
'./scripts/extension/*.ps1'
'./scripts/lib/*.ps1'
)
# Optional: Set coverage threshold
$config.CodeCoverage.CoveragePercentTarget = 80Workflow Integration
- name: Run Pester Tests with Coverage
shell: pwsh
run: |
$config = . ./scripts/tests/pester.config.ps1
$config.CodeCoverage.Enabled = $true
Invoke-Pester -Configuration $config
- name: Upload Coverage Report
uses: actions/upload-artifact@... # SHA-pinned
if: always()
with:
name: coverage-report
path: logs/coverage.xml
# Optional: Codecov integration
- name: Upload to Codecov
uses: codecov/codecov-action@... # SHA-pinned
with:
files: logs/coverage.xml
flags: powershellCoverage Thresholds
Suggested initial thresholds:
- Overall: 70%
- Per-file minimum: 50%
- Target (after all sub-issues complete): 80%
Acceptance Criteria
- Pester configuration includes coverage settings
- JaCoCo XML coverage report generated
- Coverage report uploaded as artifact
- Optional: Coverage service integration configured
- Coverage threshold enforcement (warn or fail)
Dependencies
- All script test sub-issues ([Issue]: Integrate Pester tests into PR validation workflow #195, [Issue]: Add Pester tests for LintingHelpers.psm1 module #196, [Issue]: Add Pester tests for linting scripts (5 scripts) #197, [Issue]: Add Pester tests for Validate-MarkdownFrontmatter.ps1 (detailed) #198, [Issue]: Add Pester tests for security scripts (3 scripts) #199)
- [Issue]: Add reusable Pester testing GitHub Actions workflow #194 (workflow) for artifact upload
Estimated Effort
1-2 hours
Additional Context
Why Stretch Goal
Code coverage is valuable but:
- Requires all tests to exist first
- May need external service account setup
- Threshold tuning requires baseline data
Implement after core testing infrastructure is proven.
Coverage Report Formats
- JaCoCo XML: Industry standard, supported by most services
- Cobertura: Alternative format if needed
- HTML: Local viewing (not for CI)
Related Issues
- Depends on: [Issue]: Add Pester test infrastructure (config, directories, shared mocks) #193, [Issue]: Add reusable Pester testing GitHub Actions workflow #194, [Issue]: Integrate Pester tests into PR validation workflow #195, [Issue]: Add Pester tests for LintingHelpers.psm1 module #196, [Issue]: Add Pester tests for linting scripts (5 scripts) #197, [Issue]: Add Pester tests for Validate-MarkdownFrontmatter.ps1 (detailed) #198, [Issue]: Add Pester tests for security scripts (3 scripts) #199
- Parent: [Issue]: Add Pester unit testing framework for PowerShell scripts #190
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestworkflowsGitHub Actions workflowsGitHub Actions workflows