From b2750ad7125e7ea37e66d92ffacb59fd1367508a Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Sat, 13 Jan 2024 11:50:48 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Handle=20NuGetVersion=20Edge=20C?= =?UTF-8?q?ase=20with=20repeated=20zeroes=20NugetVersion=20does=20not=20de?= =?UTF-8?q?tect=20repeated=20zeroes=20in=20a=20legacy=20nugetversion=20as?= =?UTF-8?q?=20being=20legacy=20and=20does=20not=20return=20the=20correct?= =?UTF-8?q?=20version=20type,=20causing=20the=20install=20folder=20to=20be?= =?UTF-8?q?=20incorrect.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed #58 --- ModuleFast.psm1 | 2 +- ModuleFast.tests.ps1 | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ModuleFast.psm1 b/ModuleFast.psm1 index b11369a..d21912b 100644 --- a/ModuleFast.psm1 +++ b/ModuleFast.psm1 @@ -1879,7 +1879,7 @@ function Read-RequiredSpecFile ($RequiredSpecPath) { } filter Resolve-FolderVersion([NuGetVersion]$version) { - if ($version.IsLegacyVersion) { + if ($version.IsLegacyVersion -or $version.OriginalVersion -match '\d+\.\d+\.\d+\.\d+') { return $version.version } [Version]::new($version.Major, $version.Minor, $version.Patch) diff --git a/ModuleFast.tests.ps1 b/ModuleFast.tests.ps1 index 486c864..bd6530a 100644 --- a/ModuleFast.tests.ps1 +++ b/ModuleFast.tests.ps1 @@ -429,7 +429,7 @@ Describe 'Install-ModuleFast' -Tag 'E2E' { Get-Item $installTempPath\Az.Accounts\*\Az.Accounts.psd1 | Should -Not -BeNullOrEmpty } It '4 section version numbers (VMware.PowerCLI)' { - Install-ModuleFast @imfParams 'VMware.VimAutomation.Common=13.2.0.22643733' + $actual = Install-ModuleFast @imfParams 'VMware.VimAutomation.Common=13.2.0.22643733' -PassThru Get-Item $installTempPath\VMware*\*\*.psd1 | ForEach-Object { $moduleFolderVersion = $_ | Split-Path | Split-Path -Leaf Import-PowerShellDataFile -Path $_.FullName | Select-Object -ExpandProperty ModuleVersion | Should -Be $moduleFolderVersion @@ -438,6 +438,14 @@ Describe 'Install-ModuleFast' -Tag 'E2E' { | Limit-ModulePath $installTempPath | Should -HaveCount 2 } + It '4 section version numbers with repeated zeroes' { + $actual = Install-ModuleFast @imfParams 'xDSCResourceDesigner=1.13.0.0' -PassThru + $resolvedPath = Resolve-Path $actual.Location.LocalPath + Split-Path $resolvedPath -Leaf | Should -Be '1.13.0.0' + Get-Module xDSCResourceDesigner -ListAvailable + | Limit-ModulePath $installTempPath + | Should -HaveCount 1 + } It 'lots of dependencies (Az)' { Install-ModuleFast @imfParams 'Az' (Get-Module Az* -ListAvailable).count | Should -BeGreaterThan 10