Code Coverage output within GitHub workflow #2647
Unanswered
pmatthews05
asked this question in
Q&A
Replies: 2 comments 3 replies
-
Pipe into select-object / format-table and specify the columns in the order you want them. Putting File last.
…-j
________________________________
Od: Paul Matthews ***@***.***>
Odesláno: Wednesday, May 14, 2025 3:22:35 PM
Komu: pester/Pester ***@***.***>
Kopie: Subscribed ***@***.***>
Předmět: [pester/Pester] Code Coverage output within GitHub workflow (Discussion #2647)
I have a GitHub workflow that is performing my tests, I've configured my Config like the following:
$config = New-PesterConfiguration
$config.Run.Path = "."
$config.Run.PassThru = $true
$config.Should.ErrorAction = 'Continue'
$config.TestResult.OutputPath = "$PSScriptRoot\..\tests\pester\testresults.xml"
$config.TestResult.Enabled = $true
$config.CodeCoverage.Enabled = $true
$config.CodeCoverage.OutputFormat = 'Cobertura'
$config.CodeCoverage.CoveragePercentTarget = 75
$config.CodeCoverage.Path = "$PSScriptRoot\..\.src"
$config.CodeCoverage.OutputPath = "$PSScriptRoot\..\tests\pester\coverage.xml"
$config.Output.Verbosity = 'Detailed'
$result = Invoke-Pester -Configuration $config
When I had small file names, the output on the job automatically showed File, Class, Function, Line, Command
File Class Function Line Command
---- ----- -------- ---- -------
Get-Permissions.ps1 Get-Permissions 65 $errorMessage = "Error in reading permissions.…
Get-Permissions.ps1 Get-Permissions 66 Write-ICSLog $errorMessage -Failure
Get-Permissions.ps1 Get-Permissions 67 Throw $errorMessage
Get-Permissions.ps1 Get-Permissions 78 $errorMessage = "Unable to find the Permission…
I've added more files to test, which unfortunately have longer filenames, this means the output now only shows File, Class, Function which isn't very useful to me, as I don't know which lines and commands are missing coverage.
File Class Function
---- ----- --------
Get-ResourceName.ps1 Get-ResourceName
Set-ConditionalAccessPolicy.ps1 Set-ConditionalAccessPolicy
Set-ExchangeRoleGroups.ps1 Set-ExchangeRoleGroups
Set-ExchangeRoleGroups.ps1 Set-ExchangeRoleGroups
Set-ExchangeSharedMailboxMembersPermission.ps1 Set-ExchangeSharedMailboxMembersPermission
Is there a way I can force the columns I want to display?
—
Reply to this email directly, view it on GitHub<#2647>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABLYLYIATBBQOPHTS7EHLTL26M7RXAVCNFSM6AAAAAB5DLX6XGVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZYGMZDINBUGQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
But I will try, I am now unsure how we output it, if we just write to screen then there is no easy way. You should however have the code coverage object on the result object that you get when setting PassThru
…-j
________________________________
Od: Jakub Jareš ***@***.***>
Odesláno: Wednesday, May 14, 2025 5:00:37 PM
Komu: pester/Pester ***@***.***>; pester/Pester ***@***.***>
Kopie: Subscribed ***@***.***>
Předmět: Re: [pester/Pester] Code Coverage output within GitHub workflow (Discussion #2647)
Pipe into select-object / format-table and specify the columns in the order you want them. Putting File last.
-j
________________________________
Od: Paul Matthews ***@***.***>
Odesláno: Wednesday, May 14, 2025 3:22:35 PM
Komu: pester/Pester ***@***.***>
Kopie: Subscribed ***@***.***>
Předmět: [pester/Pester] Code Coverage output within GitHub workflow (Discussion #2647)
I have a GitHub workflow that is performing my tests, I've configured my Config like the following:
$config = New-PesterConfiguration
$config.Run.Path = "."
$config.Run.PassThru = $true
$config.Should.ErrorAction = 'Continue'
$config.TestResult.OutputPath = "$PSScriptRoot\..\tests\pester\testresults.xml"
$config.TestResult.Enabled = $true
$config.CodeCoverage.Enabled = $true
$config.CodeCoverage.OutputFormat = 'Cobertura'
$config.CodeCoverage.CoveragePercentTarget = 75
$config.CodeCoverage.Path = "$PSScriptRoot\..\.src"
$config.CodeCoverage.OutputPath = "$PSScriptRoot\..\tests\pester\coverage.xml"
$config.Output.Verbosity = 'Detailed'
$result = Invoke-Pester -Configuration $config
When I had small file names, the output on the job automatically showed File, Class, Function, Line, Command
File Class Function Line Command
---- ----- -------- ---- -------
Get-Permissions.ps1 Get-Permissions 65 $errorMessage = "Error in reading permissions.…
Get-Permissions.ps1 Get-Permissions 66 Write-ICSLog $errorMessage -Failure
Get-Permissions.ps1 Get-Permissions 67 Throw $errorMessage
Get-Permissions.ps1 Get-Permissions 78 $errorMessage = "Unable to find the Permission…
I've added more files to test, which unfortunately have longer filenames, this means the output now only shows File, Class, Function which isn't very useful to me, as I don't know which lines and commands are missing coverage.
File Class Function
---- ----- --------
Get-ResourceName.ps1 Get-ResourceName
Set-ConditionalAccessPolicy.ps1 Set-ConditionalAccessPolicy
Set-ExchangeRoleGroups.ps1 Set-ExchangeRoleGroups
Set-ExchangeRoleGroups.ps1 Set-ExchangeRoleGroups
Set-ExchangeSharedMailboxMembersPermission.ps1 Set-ExchangeSharedMailboxMembersPermission
Is there a way I can force the columns I want to display?
—
Reply to this email directly, view it on GitHub<#2647>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABLYLYIATBBQOPHTS7EHLTL26M7RXAVCNFSM6AAAAAB5DLX6XGVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZYGMZDINBUGQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a GitHub workflow that is performing my tests, I've configured my Config like the following:
When I had small file names, the output on the job automatically showed
File, Class, Function, Line, Command
I've added more files to test, which unfortunately have longer filenames, this means the output now only shows
File, Class, Function
which isn't very useful to me, as I don't know which lines and commands are missing coverage.Is there a way I can force the columns I want to display?
Beta Was this translation helpful? Give feedback.
All reactions