PowerShellGetv2 icon indicating copy to clipboard operation
PowerShellGetv2 copied to clipboard

Not all functions with a Path parameter have a LiteralPath parameter

Open ThomasNieto opened this issue 6 years ago • 0 comments

Not all the functions that have a Path parameter have a corresponding LiteralPath parameter. Found this while implementing #53.

Steps to reproduce

$functions = Get-Command -Module PowerShellGet -ParameterName Path

foreach ($fun in $functions) {
    It "$fun should have a LiteralPath parameter" {
        Get-Command -Name $fun.Name -ParameterName LiteralPath -ErrorAction SilentlyContinue | Should -Not -BeNullOrEmpty
    }
}

Expected behavior

Executing script C:\test\LiteralPath.tests.ps1
  [+] New-ScriptFileInfo should have a LiteralPath parameter 22ms
  [+] Publish-Module should have a LiteralPath parameter 1ms
  [+] Publish-Script should have a LiteralPath parameter 2ms
  [+] Save-Module should have a LiteralPath parameter 2ms
  [+] Save-Script should have a LiteralPath parameter 2ms
  [+] Test-ScriptFileInfo should have a LiteralPath parameter 1ms
  [+] Update-ModuleManifest should have a LiteralPath parameter 1ms
  [+] Update-ScriptFileInfo should have a LiteralPath parameter 1ms
Tests completed in 1.13s
Tests Passed: 8, Failed: 0, Skipped: 0, Pending: 0, Inconclusive: 0

Actual behavior

Executing script C:\test\LiteralPath.tests.ps1
  [-] New-ScriptFileInfo should have a LiteralPath parameter 9ms
    Expected a value, but got $null or empty.
    5:         Get-Command -Name $fun.Name -ParameterName LiteralPath -ErrorAction SilentlyContinue | Should -Not -BeNullOrEmpty
    at <ScriptBlock>, C:\test\LiteralPath.tests.ps1: line 5
  [-] Publish-Module should have a LiteralPath parameter 2ms
    Expected a value, but got $null or empty.
    5:         Get-Command -Name $fun.Name -ParameterName LiteralPath -ErrorAction SilentlyContinue | Should -Not -BeNullOrEmpty
    at <ScriptBlock>, C:\test\LiteralPath.tests.ps1: line 5
  [+] Publish-Script should have a LiteralPath parameter 1ms
  [+] Save-Module should have a LiteralPath parameter 1ms
  [+] Save-Script should have a LiteralPath parameter 2ms
  [+] Test-ScriptFileInfo should have a LiteralPath parameter 1ms
  [-] Update-ModuleManifest should have a LiteralPath parameter 3ms
    Expected a value, but got $null or empty.
    5:         Get-Command -Name $fun.Name -ParameterName LiteralPath -ErrorAction SilentlyContinue | Should -Not -BeNullOrEmpty
    at <ScriptBlock>, C:\test\LiteralPath.tests.ps1: line 5
  [+] Update-ScriptFileInfo should have a LiteralPath parameter 1ms
Tests completed in 1.11s
Tests Passed: 5, Failed: 3, Skipped: 0, Pending: 0, Inconclusive: 0

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17134.765
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.765
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
> Get-Module -ListAvailable PowerShellGet,PackageManagement

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.4        PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     1.3.1      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     2.1.4      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
Script     2.1.2      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.1.7.2    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Binary     1.0.0.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
> Get-PackageProvider -ListAvailable

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
nuget                    2.8.5.208
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet            2.1.4.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscResource, RoleCapability, Command, Ac...
PowerShellGet            2.1.2.0
PowerShellGet            1.0.0.1
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

ThomasNieto avatar May 30 '19 05:05 ThomasNieto