< Summary - Kestrun — Combined Coverage

Information
Class: Public.Helper.Test-KrDebugContext
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Helper/Test-KrDebugContext.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 2
Coverable lines: 2
Total lines: 29
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 10/13/2025 - 16:52:37 Line coverage: 0% (0/2) Total lines: 29 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Helper/Test-KrDebugContext.ps1

#LineLine coverage
 1
 2<#
 3.SYNOPSIS
 4    Tests if the current PowerShell session is in a debugging context.
 5.DESCRIPTION
 6    Tests if the current PowerShell session is in a debugging context.
 7    This is determined by checking if a managed debugger is attached,
 8.PARAMETER IgnorePSDebugContext
 9    If set, ignores whether the session is currently paused at a breakpoint or step.
 10.PARAMETER IgnoreHostDebuggerEnabled
 11    If set, ignores whether the host's debugger is enabled (e.g., in VS Code).
 12.EXAMPLE
 13    Test-KrDebugContext
 14    Returns $true if a managed debugger is attached, the -Debug switch is used,
 15    or the KESTRUN_DEBUG environment variable is set to a truthy value; otherwise, $false.
 16#>
 17function Test-KrDebugContext {
 18    [KestrunRuntimeApi('Everywhere')]
 19    [CmdletBinding()]
 20    [outputType([bool])]
 21    param (
 22        [Parameter(Mandatory = $false)]
 23        [switch]$IgnorePSDebugContext,
 24        [Parameter(Mandatory = $false)]
 25        [switch]$IgnoreHostDebuggerEnabled
 26    )
 027    return ((-not $IgnorePSDebugContext.IsPresent) -and ($PSDebugContext)) -and
 028    ((-not $IgnoreHostDebuggerEnabled.IsPresent) -and $Host.DebuggerEnabled)
 29}

Methods/Properties

Test-KrDebugContext()