Skip to content

Commit 462fdcc

Browse files
fix: rename script module to ResolveVersion to avoid Helpers collision
The self-contained script module was named 'Helpers', which collides with the framework Helpers module (installed by PSModule/Install-PSModuleHelpers) that is also loaded in the Invoke-Pester test session. Pester's 'Mock -ModuleName Helpers' cannot disambiguate two modules sharing a name, so every test mocking Find-PSResource failed with 'Multiple script or manifest modules named Helpers are currently loaded'. Renaming the module (and its test files) to the unique name ResolveVersion removes the ambiguity. No runtime logic changed.
1 parent 930390d commit 462fdcc

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

scripts/main.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ param()
44
$PSStyle.OutputRendering = 'Ansi'
55

66
Import-Module -Name 'Helpers' -Force
7-
Import-Module -Name "$PSScriptRoot/Helpers.psm1" -Force
7+
Import-Module -Name "$PSScriptRoot/ResolveVersion.psm1" -Force
88

99
$actionInput = Read-ActionInput
1010
$config = Get-PublishConfiguration -SettingsJson $actionInput.SettingsJson
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
param()
1010

1111
# Load test data at script scope so it is available during Pester discovery (-ForEach)
12-
$TestData = Import-PowerShellDataFile -Path "$PSScriptRoot/Helpers.Tests.Data.psd1"
12+
$TestData = Import-PowerShellDataFile -Path "$PSScriptRoot/ResolveVersion.Tests.Data.psd1"
1313

1414
BeforeAll {
1515
# Install PSSemVer for version handling
@@ -25,7 +25,7 @@ BeforeAll {
2525
}
2626

2727
# Import the module under test
28-
Import-Module -Name "$PSScriptRoot/../scripts/Helpers.psm1" -Force
28+
Import-Module -Name "$PSScriptRoot/../scripts/ResolveVersion.psm1" -Force
2929
}
3030

3131
Describe 'Resolve-ReleaseDecision' {
@@ -92,7 +92,7 @@ Describe 'Resolve-ReleaseDecision' {
9292

9393
Describe 'Get-NextModuleVersion' {
9494
BeforeAll {
95-
Mock -CommandName Find-PSResource -ModuleName Helpers -MockWith { @() }
95+
Mock -CommandName Find-PSResource -ModuleName ResolveVersion -MockWith { @() }
9696
$emptyReleases = @([PSCustomObject]@{ tagName = 'v0.0.0'; isLatest = $false; isPrerelease = $false })
9797
}
9898

@@ -133,7 +133,7 @@ Describe 'Get-NextModuleVersion' {
133133

134134
Describe 'End-to-end: Resolve-ReleaseDecision + Get-NextModuleVersion' {
135135
BeforeAll {
136-
Mock -CommandName Find-PSResource -ModuleName Helpers -MockWith { @() }
136+
Mock -CommandName Find-PSResource -ModuleName ResolveVersion -MockWith { @() }
137137
$emptyReleases = @([PSCustomObject]@{ tagName = 'v0.0.0'; isLatest = $false; isPrerelease = $false })
138138
}
139139

0 commit comments

Comments
 (0)