Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke-PSDepend -Test / Test-Dependency should indicate when a dependency isn't installed #87

Open
tlindsay42 opened this issue Jun 16, 2018 · 2 comments

Comments

@tlindsay42
Copy link
Contributor

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...}
@RamblingCookieMonster
Copy link
Owner

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!

@tlindsay42
Copy link
Contributor Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants