-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDisable-CommandCoverage.ps1
32 lines (31 loc) · 2.28 KB
/
Disable-CommandCoverage.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function Disable-CommandCoverage
{
<#
.Synopsis
Disables command coverage for a module
.Description
Disables command coverage tracing for a module
.Example
Disable-CommandCoverage
.Link
Enable-CommandCoverage
#>
[OutputType([Nullable])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "", Justification="This needs to be global")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseDeclaredVarsMoreThanAssignments", "", Justification="This clears a global")]
param(
# The name of the module that will be instrumented for command coverage
[Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)]
[Alias('Name')]
[string]
$Module
)
process {
#region Get Commands and Remove Breakpoints
$moduleCommands = Get-Command -Module $module -commandType Function | ForEach-Object { $_.Name }
Get-PSBreakpoint -Command $moduleCommands |
Remove-PSBreakpoint
$Global:CommandCoverage = $null
#endregion Get Commands and Remove Breakpoints
}
}