< 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@6135d944f8787fb570e4dfbacac6e80312799a86
Line coverage
90%
Covered lines: 27
Uncovered lines: 3
Coverable lines: 30
Total lines: 66
Line coverage: 90%
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@844b5179fb0492dc6b1182bae3ff65fa7365521d04/19/2026 - 15:52:57 Line coverage: 90% (27/30) Total lines: 66 Tag: Kestrun/Kestrun@765a8f13c573c01494250a29d6392b6037f087c9

Coverage delta

Coverage delta 2 -2

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    $applicationDataFolders = @()
 145    if ($normalizedDescriptor.PSObject.Properties.Match('ApplicationDataFolders').Count -gt 0 -and $null -ne $normalized
 246        $applicationDataFolders = @($normalizedDescriptor.ApplicationDataFolders)
 47    }
 48
 149    $props = $normalizedDescriptor.PSObject.Properties
 50
 251    [pscustomobject]([ordered]@{
 152            FormatVersion = [string]$normalizedDescriptor.FormatVersion
 153            Path = $fullPath
 154            Name = [string]$normalizedDescriptor.Name
 355            Description = if ($props['Description']) { [string]$normalizedDescriptor.Description } else { $null }
 156            Version = if ($props['Version'] -and -not [string]::IsNullOrWhiteSpace($normalizedDescriptor.Version)) {
 157                [string]$normalizedDescriptor.Version
 58            } else {
 159                $null
 60            }
 361            EntryPoint = if ($props['EntryPoint']) { [string]$normalizedDescriptor.EntryPoint } else { $null }
 362            ServiceLogPath = if ($props['ServiceLogPath']) { [string]$normalizedDescriptor.ServiceLogPath } else { $null
 163            PreservePaths = $preservePaths
 164            ApplicationDataFolders = $applicationDataFolders
 65        })
 66}

Methods/Properties

Get-KrServiceDescriptor()