Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ModuleFast.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1673,7 +1673,7 @@ function Find-LocalModule {
if ($Update -and ($ModuleSpec.Max -ne $candidateVersion)) {
Write-Debug "${ModuleSpec}: Skipping $candidateVersion because -Update was specified and the version does not exactly meet the upper bound of the spec or no upper bound was specified at all, meaning there is a possible newer version remotely."
#We can use this ref later to find out if our best remote version matches what is installed without having to read the manifest again
if ($BestCandidate -and $manifestCandidate.ModuleVersion -gt $bestCandidate.Value[$moduleSpec]) {
if ($bestCandidate.Value[$moduleSpec] -and $manifestCandidate.ModuleVersion -gt $bestCandidate.Value[$moduleSpec]) {
Write-Debug "${ModuleSpec}: New Best Candidate Version $($manifestCandidate.ModuleVersion)"
$BestCandidate.Value.Add($moduleSpec, $manifestCandidate)
}
Expand Down
6 changes: 6 additions & 0 deletions ModuleFast.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,12 @@ Describe 'Install-ModuleFast' -Tag 'E2E' {
Install-ModuleFast @imfParams 'Az.Compute', 'Az.CosmosDB' -Update -Plan
| Should -BeNullOrEmpty
}
It 'Updates if multiple local versions installed' {
Install-ModuleFast @imfParams 'Plaster=1.1.1'
Install-ModuleFast @imfParams 'Plaster=1.1.3'
$actual = Install-ModuleFast @imfParams 'Plaster' -Update -PassThru
$actual.ModuleVersion | Should -Be '1.1.4'
}

It 'Updates only dependent module that requires update' {
Install-ModuleFast @imfParams @{ ModuleName = 'Az.Accounts'; RequiredVersion = '2.10.2' }
Expand Down