< Summary - Kestrun — Combined Coverage

Information
Class: Public.Service.Get-KrServiceDescriptor
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Service/Get-KrServiceDescriptor.ps1
Tag: Kestrun/Kestrun@09cad9a8fdafda7aca15f5f5e888b4bbcc8f0674
Line coverage
88%
Covered lines: 23
Uncovered lines: 3
Coverable lines: 26
Total lines: 60
Line coverage: 88.4%
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 03/26/2026 - 03:54:59 Line coverage: 88.4% (23/26) Total lines: 60 Tag: Kestrun/Kestrun@844b5179fb0492dc6b1182bae3ff65fa7365521d

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Service/Get-KrServiceDescriptor.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Reads a Service.psd1 descriptor file.
 4.DESCRIPTION
 5    Reads Service.psd1 and returns a normalized object with FormatVersion, Name, Description, Version, EntryPoint, Servi
 6.PARAMETER Path
 7    Descriptor path. Accepts either a descriptor file path or a directory path.
 8    When a directory path is provided, Service.psd1 is appended automatically.
 9.EXAMPLE
 10    Get-KrServiceDescriptor
 11#>
 12function Get-KrServiceDescriptor {
 13    [KestrunRuntimeApi('Everywhere')]
 14    [CmdletBinding()]
 15    [OutputType([pscustomobject])]
 16    param(
 17        [Parameter()]
 18        [ValidateNotNullOrEmpty()]
 19        [string]$Path = 'Service.psd1'
 20    )
 21
 122    $fullPath = [System.IO.Path]::GetFullPath($Path)
 123    if (Test-Path -LiteralPath $fullPath -PathType Container) {
 124        $fullPath = Join-Path -Path $fullPath -ChildPath 'Service.psd1'
 25    }
 26
 227    if (-not (Test-Path -LiteralPath $fullPath -PathType Leaf)) {
 028        throw "Descriptor file not found: $fullPath"
 29    }
 130    $descriptor = Import-PowerShellDataFile -LiteralPath $fullPath
 231    if (-not $descriptor -or -not ($descriptor -is [hashtable])) {
 032        throw "Descriptor file '$fullPath' is not a valid hashtable."
 33    }
 234    $normalizedDescriptor = Test-KrServiceDescriptorData -Descriptor $descriptor -DescriptorPath $fullPath -PackageRoot 
 135    if (-not $normalizedDescriptor) {
 036        throw "Descriptor file '$fullPath' failed validation."
 37    }
 38
 139    $preservePaths = @()
 140    if ($normalizedDescriptor.PSObject.Properties.Match('PreservePaths').Count -gt 0 -and $null -ne $normalizedDescripto
 241        $preservePaths = @($normalizedDescriptor.PreservePaths)
 42    }
 43
 144    $props = $normalizedDescriptor.PSObject.Properties
 45
 246    [pscustomobject]([ordered]@{
 147            FormatVersion = [string]$normalizedDescriptor.FormatVersion
 148            Path = $fullPath
 149            Name = [string]$normalizedDescriptor.Name
 350            Description = if ($props['Description']) { [string]$normalizedDescriptor.Description } else { $null }
 151            Version = if ($props['Version'] -and -not [string]::IsNullOrWhiteSpace($normalizedDescriptor.Version)) {
 152                [string]$normalizedDescriptor.Version
 53            } else {
 154                $null
 55            }
 356            EntryPoint = if ($props['EntryPoint']) { [string]$normalizedDescriptor.EntryPoint } else { $null }
 357            ServiceLogPath = if ($props['ServiceLogPath']) { [string]$normalizedDescriptor.ServiceLogPath } else { $null
 158            PreservePaths = $preservePaths
 59        })
 60}

Methods/Properties

Get-KrServiceDescriptor()