Skip to content

Commit bbc26b2

Browse files
committed
🧪Fix regressions from breaking change
1 parent 0427fc2 commit bbc26b2

5 files changed

Lines changed: 19 additions & 18 deletions

File tree

ModuleFast.psm1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ class ModuleFastInfo: IComparable {
785785
}
786786

787787
[string] ToString() {
788-
return "$($this.Name)@$($this.ModuleVersion)"
788+
return "$($this.Name)($($this.ModuleVersion))"
789789
}
790790
[string] ToUniqueString() {
791791
return "$($this.Name)-$($this.ModuleVersion)-$($this.Location)"
@@ -1452,7 +1452,7 @@ filter ConvertFrom-RequiredSpec {
14521452
continue
14531453
}
14541454
if ($kv.Value -as [NuGetVersion]) {
1455-
[ModuleFastSpec]"$($kv.Name)@$($kv.Value)"
1455+
[ModuleFastSpec]"$($kv.Name)=$($kv.Value)"
14561456
continue
14571457
}
14581458

@@ -1490,6 +1490,7 @@ function Read-RequiredSpecFile ($RequiredSpecPath) {
14901490
if ($uri.scheme -in 'http', 'https') {
14911491
[string]$content = (Invoke-WebRequest -Uri $uri).Content
14921492
if ($content.StartsWith('@{')) {
1493+
#HACK: Cannot read PowerShell Data Files from a string, the interface is private, so we write to a temp file as a workaround.
14931494
$tempFile = [io.path]::GetTempFileName()
14941495
$content > $tempFile
14951496
return Import-PowerShellDataFile -Path $tempFile

ModuleFast.tests.ps1

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Import-Module $PSScriptRoot/ModuleFast.psm1 -Force
99

1010
BeforeAll {
1111
if ($env:MFURI) {
12-
$PSDefaultParameterValues['Get-ModuleFastPlan:Source'] = $env:MFURI
12+
$PSDefaultParameterValues['*-ModuleFast*:Source'] = $env:MFURI
1313
}
1414
}
1515

@@ -361,7 +361,7 @@ Describe 'Get-ModuleFastPlan' -Tag 'E2E' {
361361
$actual.ModuleVersion | Should -Be '0.0.2-prerelease'
362362
}
363363
It 'Detects Prerelease even if Prerelease not specified' {
364-
$actual = Get-ModuleFastPlan 'PrereleaseTest@0.0.2-prerelease'
364+
$actual = Get-ModuleFastPlan 'PrereleaseTest=0.0.2-prerelease'
365365
$actual.ModuleVersion | Should -Be '0.0.2-prerelease'
366366
}
367367

@@ -409,7 +409,7 @@ Describe 'Install-ModuleFast' -Tag 'E2E' {
409409
Get-Item $installTempPath\Az.Accounts\*\Az.Accounts.psd1 | Should -Not -BeNullOrEmpty
410410
}
411411
It '4 section version numbers (VMware.PowerCLI)' {
412-
Install-ModuleFast @imfParams 'VMware.VimAutomation.Common@13.2.0.22643733'
412+
Install-ModuleFast @imfParams 'VMware.VimAutomation.Common=13.2.0.22643733'
413413
Get-Item $installTempPath\VMware*\*\*.psd1 | ForEach-Object {
414414
$moduleFolderVersion = $_ | Split-Path | Split-Path -Leaf
415415
Import-PowerShellDataFile -Path $_.FullName | Select-Object -ExpandProperty ModuleVersion | Should -Be $moduleFolderVersion
@@ -487,23 +487,23 @@ Describe 'Install-ModuleFast' -Tag 'E2E' {
487487
| Should -BeGreaterThan ([version]'5.0.0')
488488
}
489489
It 'Errors trying to install prerelease over regular module' {
490-
Install-ModuleFast @imfParams 'PrereleaseTest@0.0.1'
491-
{ Install-ModuleFast @imfParams 'PrereleaseTest@0.0.1-prerelease' }
490+
Install-ModuleFast @imfParams 'PrereleaseTest=0.0.1'
491+
{ Install-ModuleFast @imfParams 'PrereleaseTest=0.0.1-prerelease' }
492492
| Should -Throw '*is newer than the requested prerelease version*'
493493
}
494494
It 'Errors trying to install older prerelease over regular module' {
495-
Install-ModuleFast @imfParams 'PrereleaseTest@0.0.1'
496-
{ Install-ModuleFast @imfParams 'PrereleaseTest@0.0.1-prerelease' }
495+
Install-ModuleFast @imfParams 'PrereleaseTest=0.0.1'
496+
{ Install-ModuleFast @imfParams 'PrereleaseTest=0.0.1-prerelease' }
497497
| Should -Throw '*is newer than the requested prerelease version*'
498498
}
499499
It 'Installs regular module over prerelease module with warning' {
500-
Install-ModuleFast @imfParams 'PrereleaseTest@0.0.1-prerelease'
501-
Install-ModuleFast @imfParams 'PrereleaseTest@0.0.1' -WarningVariable actual *>&1 | Out-Null
500+
Install-ModuleFast @imfParams 'PrereleaseTest=0.0.1-prerelease'
501+
Install-ModuleFast @imfParams 'PrereleaseTest=0.0.1' -WarningVariable actual *>&1 | Out-Null
502502
$actual | Should -BeLike '*is newer than existing prerelease version*'
503503
}
504504
It 'Installs newer prerelease with warning' {
505-
Install-ModuleFast @imfParams 'PrereleaseTest@0.0.1-aprerelease'
506-
Install-ModuleFast @imfParams 'PrereleaseTest@0.0.1-bprerelease' -WarningVariable actual *>&1 | Out-Null
505+
Install-ModuleFast @imfParams 'PrereleaseTest=0.0.1-aprerelease'
506+
Install-ModuleFast @imfParams 'PrereleaseTest=0.0.1-bprerelease' -WarningVariable actual *>&1 | Out-Null
507507
$actual | Should -BeLike '*is newer than existing prerelease version*'
508508
}
509509

@@ -587,7 +587,7 @@ Describe 'Install-ModuleFast' -Tag 'E2E' {
587587

588588
It 'Installs from CI File and Installs CI Pinned Version' {
589589
Set-Location $testDrive
590-
Install-ModuleFast @imfParams -CI -Specification 'PreReleaseTest@0.0.1-prerelease'
590+
Install-ModuleFast @imfParams -CI -Specification 'PreReleaseTest=0.0.1-prerelease'
591591
Get-Item 'requires.lock.json' | Should -Not -BeNullOrEmpty
592592

593593
Remove-Item $imfParams.Destination -Recurse -Force

Test/Mocks/ModuleFast.requires.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"PnP.PowerShell": "2.2.156-nightly",
3-
"Pester": "@5.4.0",
3+
"Pester": "=5.4.0",
44
"Az.Accounts": ":[2.0.0, 2.13.2)",
55
"ImportExcel": "latest",
66
"PSScriptAnalyzer": "<=1.21.0"

Test/Mocks/ModuleFast.requires.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
'ImportExcel' = 'latest'
33
'PnP.PowerShell' = '2.2.156-nightly'
44
'PSScriptAnalyzer' = '<=1.21.0'
5-
'Pester' = '@5.4.0'
5+
'Pester' = '=5.4.0'
66
'Az.Accounts' = ':[2.0.0, 2.13.2)'
77
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
"ImportExcel",
3-
"PnP.PowerShell@2.2.156-nightly",
3+
"PnP.PowerShell=2.2.156-nightly",
44
"PSScriptAnalyzer<=1.21.0",
5-
"Pester@5.4.0",
5+
"Pester=5.4.0",
66
"Az.Accounts:[2.0.0, 2.13.2)"
77
]

0 commit comments

Comments
 (0)