en-US/about_PSCoverage.help.txt
TOPIC
about_PSCoverage SHORT DESCRIPTION This module provides a simple interface to coveralls.io. It enables you to format your coverage report generated by Pester to upload it. LONG DESCRIPTION Unfortunately Pester does not provide any interfaces to upload the coverage reports to external services. Therefore this module was developed. INSTALLING PSCoverage The easiest way to install this module is to use the PowerShell built in package management. Therefore use `Install-Module 'PSCoverage' -AllowPrerelease` to get the latest release from powershellgallery.com. GETTING STARTED Navigate to your module/ repository root. Your module structure needs to be like this: Eg.: ---------------------------------------- ~\src\ Private\ Invoke-Foobar.ps1 Functions\ External\ ~\tests\ Private\ Invoke-Foobar.Tests.ps1 Functions\ External\ ~\ModuleManifest.psd1 ~\ModuleScript.psm1 ---------------------------------------- 1. First you need a list of all your src files: $srcFiles = Get-ChildItem -Path ".\src\*.ps1" -Recurse | Sort-Object -Property 'Name' | Select-Object -ExpandProperty 'FullName' 2. Next you need a list with all your pester tests files: $testFiles = Get-ChildItem -Path ".\tests\*.Tests.ps1" -Recurse | Sort-Object -Property 'Name' | Select-Object -ExpandProperty 'FullName' 3. The simplest way to get you code coverage is by creating it with your unit tests. This avoids rerunning all the test with PSCoverage: $TestResults = Invoke-Pester -Path $testFiles -CodeCoverage $srcFiles -PassThru 4. An then PassThru the code coverage to create a new report: $CoverallsIOReport = New-CoverageReport -CodeCoverage $TestResults.CodeCoverage -RepoToken '123456' -ModuleRoot $PWD 5. Finally we can upload the coverage report to coveralls.io: Publish-CoverageReport -CoverageReport $CoverallsIOReport SEE ALSO about_PSCoverage |