< Summary - Kestrun — Combined Coverage

Information
Class: Private.Server.Helper
Assembly: Kestrun.PowerShell.Private
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Server/Helper.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 35
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 09/04/2025 - 22:37:32 Line coverage: 100% (8/8) Total lines: 35 Tag: Kestrun/Kestrun@afb7aadc0a8a42bfa2b51ea62c8a6e2cf63faec610/13/2025 - 16:52:37 Line coverage: 0% (0/8) Total lines: 35 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Server/Helper.ps1

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Returns modules imported by the user session.
 4
 5    .DESCRIPTION
 6        Filters the list of currently loaded modules to exclude built-in PowerShell
 7        modules, Visual Studio Code host modules and Microsoft.PowerShell.* modules.
 8        The result represents modules explicitly imported by the user or scripts.
 9#>
 10function Get-KrUserImportedModule {
 11    [CmdletBinding()]
 12    [OutputType([System.Management.Automation.PSModuleInfo])]
 13    param()
 14
 15    # ----- constants ----------------------------------------------------------
 016    $inboxRoot = [IO.Path]::GetFullPath( (Join-Path $PSHOME 'Modules') )
 17
 18    # regex fragment that matches “…\.vscode\extensions\ms-vscode.powershell…”
 019    $vsCodeRegex = [Regex]::Escape(
 20        [IO.Path]::Combine('.vscode', 'extensions', 'ms-vscode.powershell')
 21    ) -replace '\\\\', '[\\/]'   # make path-separator agnostic
 22    # -------------------------------------------------------------------------
 23
 024    Get-Module | Where-Object {
 025        $path = [IO.Path]::GetFullPath($_.ModuleBase)
 26
 027        $isInbox = $path.StartsWith($inboxRoot,
 28            $IsWindows ? 'OrdinalIgnoreCase' : 'Ordinal')
 029        $isVSCode = $path -match $vsCodeRegex
 030        $isMSPSSpace = $_.Name -like 'Microsoft.PowerShell.*'
 31
 032        -not ($isInbox -or $isVSCode -or $isMSPSSpace)
 33    }
 34}
 35

Methods/Properties

Get-KrUserImportedModule()