PSDepend
PSDepend copied to clipboard
Invoke-PSDepend -Test / Test-Dependency should indicate when a dependency isn't installed
When I run either Invoke-PSDepend -Test
or Get-Dependency | Test-Dependency
, the output does not indicate whether the dependency is installed or not. I get the same results in Windows PowerShell 5.1 as PowerShell Core 6.0.2.
If I run Test-Dependency -Quiet
, the Boolean indicator is correct for all PSGalleryModule dependencies, but my npm package that is installed in global scope is not.
For the following tests, the Coveralls module is uninstalled, and all others are installed correctly.
Example 1a: Invoke-PSDepend -Test
Invoke-PSDepend -Path .\requirements.psd1 -Test
DependencyName : platyPS
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
DependencyName : Coveralls
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
DependencyName : psake
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
DependencyName : BuildHelpers
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
DependencyName : markdown-spellcheck
DependencyType : npm
Version : Latest
Tags : npm
DependencyName : Pester
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
DependencyName : PSDeploy
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
Example 1b: Test-Dependency
Get-Dependency | Test-Dependency
DependencyName : platyPS
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
DependencyName : Coveralls
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
DependencyName : psake
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
DependencyName : BuildHelpers
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
DependencyName : markdown-spellcheck
DependencyType : npm
Version : Latest
Tags : npm
DependencyName : Pester
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
DependencyName : PSDeploy
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
Example 2: Test-Dependency -Quiet
Get-Dependency | Test-Dependency -Quiet
True
False
True
True
False
True
True
Example 3: Test-Dependency -Verbose
Get-Dependency | Test-Dependency -Verbose
VERBOSE: Running Invoke-DependencyScript with ParameterSetName 'Map' and params:
Key Value
--- -----
Verbose True
Dependency {@{DependencyFile=C:\Users\example\git\ArmorPowerShell\requirements.psd1; DependencyName=platyPS; DependencyType=PSGalleryModule; Name=platyPS; Version=Latest; Parameters=; Source=; Target=CurrentUser; AddToPath=; Tags=PSGalleryModule;
DependsOn=; PreScripts=; PostScripts=; PSDependOptions=System.Collections.Hashtable; Raw=}}
PSDependAction {Test}
VERBOSE: Dependencies:
DependencyFile : C:\Users\example\git\ArmorPowerShell\requirements.psd1
DependencyName : platyPS
DependencyType : PSGalleryModule
Name : platyPS
Version : Latest
Parameters :
Source :
Target : CurrentUser
AddToPath :
Tags : PSGalleryModule
DependsOn :
PreScripts :
PostScripts :
PSDependOptions : {Target, Tags}
Raw :
VERBOSE: Searching for C:\Users\example\Documents\WindowsPowerShell\Modules\PSDepend\0.2.5\PSDependScripts\PSGalleryModule.ps1
VERBOSE: Searching for PSGalleryModule.ps1
VERBOSE: Get-Parameters for C:\Users\example\Documents\WindowsPowerShell\Modules\PSDepend\0.2.5\PSDependScripts\PSGalleryModule.ps1\PSGalleryModule.ps1
VERBOSE: Found parameters [AllowClobber Dependency Import PSDependAction Repository SkipPublisherCheck]
VERBOSE: Invoking 'C:\Users\example\Documents\WindowsPowerShell\Modules\PSDepend\0.2.5\PSDependScripts\PSGalleryModule.ps1' with parameters
Name Value
---- -----
Dependency @{DependencyFile=C:\Users\example\git\ArmorPowerShell\requirements.psd1; DependencyName=platyPS; DependencyType=PSGalleryModule; Name=platyPS; Version=Latest; Parameters=; Source=; Target=CurrentUser; AddToPath=;
Tags=PSGalleryModule; DependsOn=; PreScripts=; PostScripts=; PSDependOptions=System.Collections.Hashta...
PSDependAction {Test}
VERBOSE: Getting dependency [platyPS] from PowerShell repository [PSGallery]
VERBOSE: Populating RepositorySourceLocation property for module platyPS.
VERBOSE: Loading module from path 'C:\Users\example\Documents\WindowsPowerShell\Modules\platyPS\0.10.0\platyPS.psm1'.
VERBOSE: Populating RepositorySourceLocation property for module platyPS.
VERBOSE: Loading module from path 'C:\Users\example\Documents\WindowsPowerShell\Modules\platyPS\0.9.0\platyPS.psm1'.
VERBOSE: Populating RepositorySourceLocation property for module platyPS.
VERBOSE: Loading module from path 'C:\Users\example\Documents\WindowsPowerShell\Modules\platyPS\0.8.3\platyPS.psm1'.
VERBOSE: Found existing module [platyPS]
VERBOSE: You have the latest version of [platyPS], with installed version [0.10.0] and PSGallery version [0.10.0]
DependencyName : platyPS
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
VERBOSE: Running Invoke-DependencyScript with ParameterSetName 'Map' and params:
Key Value
--- -----
Verbose True
Dependency {@{DependencyFile=C:\Users\example\git\ArmorPowerShell\requirements.psd1; DependencyName=Coveralls; DependencyType=PSGalleryModule; Name=Coveralls; Version=Latest; Parameters=; Source=; Target=CurrentUser; AddToPath=; Tags=PSGalleryModule;
DependsOn=; PreScripts=; PostScripts=; PSDependOptions=System.Collections.Hashtable; Raw=}}
PSDependAction {Test}
VERBOSE: Dependencies:
DependencyFile : C:\Users\example\git\ArmorPowerShell\requirements.psd1
DependencyName : Coveralls
DependencyType : PSGalleryModule
Name : Coveralls
Version : Latest
Parameters :
Source :
Target : CurrentUser
AddToPath :
Tags : PSGalleryModule
DependsOn :
PreScripts :
PostScripts :
PSDependOptions : {Target, Tags}
Raw :
VERBOSE: Searching for C:\Users\example\Documents\WindowsPowerShell\Modules\PSDepend\0.2.5\PSDependScripts\PSGalleryModule.ps1
VERBOSE: Searching for PSGalleryModule.ps1
VERBOSE: Get-Parameters for C:\Users\example\Documents\WindowsPowerShell\Modules\PSDepend\0.2.5\PSDependScripts\PSGalleryModule.ps1\PSGalleryModule.ps1
VERBOSE: Found parameters [AllowClobber Dependency Import PSDependAction Repository SkipPublisherCheck]
VERBOSE: Invoking 'C:\Users\example\Documents\WindowsPowerShell\Modules\PSDepend\0.2.5\PSDependScripts\PSGalleryModule.ps1' with parameters
Name Value
---- -----
Dependency @{DependencyFile=C:\Users\example\git\ArmorPowerShell\requirements.psd1; DependencyName=Coveralls; DependencyType=PSGalleryModule; Name=Coveralls; Version=Latest; Parameters=; Source=; Target=CurrentUser; AddToPath=;
Tags=PSGalleryModule; DependsOn=; PreScripts=; PostScripts=; PSDependOptions=System.Collections.Ha...
PSDependAction {Test}
VERBOSE: Getting dependency [Coveralls] from PowerShell repository [PSGallery]
DependencyName : Coveralls
DependencyType : PSGalleryModule
Version : Latest
Tags : PSGalleryModule
VERBOSE: Running Invoke-DependencyScript with ParameterSetName 'Map' and params:
Key Value
--- -----
Verbose True
Dependency {@{DependencyFile=C:\Users\example\git\ArmorPowerShell\requirements.psd1; DependencyName=psake; DependencyType=PSGalleryModule; Name=psake; Version=Latest; Parameters=; Source=; Target=CurrentUser; AddToPath=; Tags=PSGalleryModule;
DependsOn=; PreScripts=; PostScripts=; PSDependOptions=System.Collections.Hashtable; Raw=}}
PSDependAction {Test}
PSDepend Version
Get-Module -Name PSDepend
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.2.5 PSDepend {Get-Dependency, Get-PSDependScript, Get-PSDependType, Import-Dependency...}
Hi!
Can you try running through select *
? I suspect the output is hidden, given that they're still the same object type - they just have a DependencyExists property added
Also... the test piece is sort of ugly and relies on the dependency script handling test output correctly, so... there's definitely a chance something could go wrong : )
Cheers!
Hi!
Confirmed, the new DependencyExists property on each object was hidden by the format. PR to follow.
Also, the test value is still incorrect for my npm dependency, but the PSGalleryModule dependencies are yielding valid test results.
Thanks!