Skip to content

Commit bcd3fc7

Browse files
committed
Clarify instructions for obtaining code coverage in tests and update verbosity setting in Pester configuration
1 parent 1ca5b5f commit bcd3fc7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

.github/instructions/dsc-community-style-guidelines.instructions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ Always run build script from root path.
2525
- Always build project prior to running tests: `.\build.ps1 -Tasks build`
2626
- Always run `Invoke-Pester` from root path: `Invoke-Pester -Path @('<test paths>') -Output Detailed`
2727
- After adding or changing classes, always run tests in new session.
28-
- To run a test file with code coverage (this can takes a while for large codebases):
28+
- To get code coverage (this can takes a while for large codebases):
2929
```powershell
3030
.\build.ps1 -Tasks noop
3131
$config = New-PesterConfiguration
3232
$config.Run.Path = @('<test paths>')
3333
$config.CodeCoverage.Enabled = $true
3434
$config.CodeCoverage.Path = @('./output/builtModule/<ModuleName>')
3535
$config.CodeCoverage.CoveragePercentTarget = 0
36-
$config.Output.Verbosity = 'Detailed'
36+
$config.Output.Verbosity = 'None'
3737
$config.Run.PassThru = $true
3838
$result = Invoke-Pester -Configuration $config
39-
# After running above, get all commands that was missed with a reference to the SourceLineNumber in SourceFile.
40-
$result.CodeCoverage.CommandsMissed | Where-Object { $_.Function -eq '<FunctionName>' -or $_.Class -eq '<ClassName>' } | Convert-LineNumber -PassThru | Select-Object Class, Function, Command, SourceLineNumber, SourceFile
39+
# After running above, get all commands that was missed, no output equals no missed lines
40+
$result.CodeCoverage.CommandsMissed | Where-Object { $_.Function -eq 'FunctionName' -or $_.Class -eq 'ClassName' } | Convert-LineNumber -PassThru | Select-Object Class, Function, Command, SourceLineNumber, SourceFile
4141
```
4242

4343
## Change log

0 commit comments

Comments
 (0)