< Summary - Kestrun — Combined Coverage

Information
Class: Private.Assembly.Get-EntryScriptPath
Assembly: Kestrun.PowerShell.Private
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Assembly/Get-EntryScriptPath.ps1
Tag: Kestrun/Kestrun@ca54e35c77799b76774b3805b6f075cdbc0c5fbe
Line coverage
81%
Covered lines: 9
Uncovered lines: 2
Coverable lines: 11
Total lines: 40
Line coverage: 81.8%
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 01/08/2026 - 02:20:28 Line coverage: 0% (0/11) Total lines: 40 Tag: Kestrun/Kestrun@4bc17b7e465c315de6386907c417e44fcb0fd3eb01/21/2026 - 17:07:46 Line coverage: 81.8% (9/11) Total lines: 40 Tag: Kestrun/Kestrun@3f6f61710c7ef7d5953cab578fe699c1e5e01a36

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Assembly/Get-EntryScriptPath.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Gets the path of the entry script that invoked the current script.
 4.DESCRIPTION
 5    This function inspects the PowerShell call stack to determine the script path
 6    of the entry script that invoked the current script. It excludes the current
 7    script's path from consideration.
 8.OUTPUTS
 9    [string] - The path of the entry script, or $null if not found.
 10.NOTES
 11    This function is part of the Kestrun PowerShell module.
 12#>
 13function Get-EntryScriptPath {
 14    [CmdletBinding()]
 15    [OutputType([string])]
 16    param()
 17
 218    $self = $PSCommandPath ? (Resolve-Path -LiteralPath $PSCommandPath).ProviderPath : $null
 19
 20    # Take the last real script caller in the stack
 221    $stack = @(Get-PSCallStack)
 122    [System.Array]::Reverse($stack)
 123    foreach ($f in $stack) {
 124        $p = $f.InvocationInfo.ScriptName
 125        if (-not $p) { continue }
 26
 27        try {
 228            $resolved = (Resolve-Path -LiteralPath $p -ErrorAction Stop).ProviderPath
 29        } catch {
 030            Write-Debug "Failed to resolve path '$p': $_"
 31            continue
 32        }
 33
 134        if ($resolved -and $resolved -ne $self) {
 135            return $resolved
 36        }
 37    }
 38
 039    return $null
 40}

Methods/Properties

Get-EntryScriptPath()