Project

PSPublishModule

PSPublishModule is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars47
Forks16
Open issues0
PowerShell Gallery downloads17213
Releasev3.0.131
Language: C# Updated: 2026-09-02T21:02:59.0000000+00:00

Curated Examples

Example.Moduletestingcicdadvanced

Source-owned example maintained with PSPublishModule.

# Example: Advanced CI/CD with Custom Result Processing
# Shows how to use CI/CD mode with custom result handling for advanced scenarios

param(
    [string]$ProjectPath = $PSScriptRoot,
    [string]$ResultsFile = (Join-Path $PSScriptRoot 'test-results.json')
)

# Run tests in CI/CD mode - this handles most CI/CD concerns automatically
$results = Invoke-ModuleTestSuite -ProjectPath $ProjectPath -CICD -EnableCodeCoverage

# Optional: Export detailed results for further processing
if ($results) {
    $moduleInfo = Get-ModuleInformation -Path $ProjectPath
    $summary = @{
        Module      = $moduleInfo.ModuleName
        Success     = $results.FailedCount -eq 0
        TotalTests  = $results.TotalCount
        PassedTests = $results.PassedCount
        FailedTests = $results.FailedCount
        Duration    = $results.Duration
        Timestamp   = Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
    }

    if ($null -ne $results.CoveragePercent) {
        $summary.CodeCoveragePercent = [math]::Round($results.CoveragePercent, 2)
    }

    $summary | ConvertTo-Json | Out-File -FilePath $ResultsFile -Encoding UTF8
    Write-Host "Results exported to: $ResultsFile" -ForegroundColor Cyan
}