Skip to content

Commit 25c9cd8

Browse files
🪲 [Fix]: Built modules with resolved versions can be tested (#119)
Built modules whose manifests carry a real, resolved version can now be tested by `Test-PSModule`. Previously the action installed the built module under the historical `999.0.0` placeholder folder, so module tests failed once the build flow started stamping manifests with the version that will actually be shipped. ## Fixed: Built modules with resolved versions can be tested `Test-PSModule` now installs and validates built module outputs whose manifest `ModuleVersion` has already been resolved to the real build version. The module is installed under a matching version folder before module tests run, so PowerShell accepts the manifest and Pester validates the artifact from the expected path. This is delivered by bumping the pinned `PSModule/Install-PSModuleHelpers` to `v1.0.8`, which installs built modules at their real version instead of the `999.0.0` placeholder. ## Technical Details - `action.yml`: `PSModule/Install-PSModuleHelpers` pin bumped `v1.0.7` -> `v1.0.8` (the release from [PSModule/Install-PSModuleHelpers#19](PSModule/Install-PSModuleHelpers#19)). - `src/tests/Module/PSModule/PSModule.Tests.ps1`: new test asserting the installed version folder matches the manifest `ModuleVersion`, guarding against a regression to the `999.0.0` behavior. - `tests/outputTestRepo/outputs/module/PSModuleTest/PSModuleTest.psd1`: fixture `ModuleVersion` updated `999.0.0` -> `3.0.11` to model the current build output. - The branch is merged up to date with `main`, which already carries the `actions/checkout` v7.0.0, `super-linter` v8.7.0, and `PSModule/Invoke-Pester` v4.2.6 pins, so this PR no longer changes those.
1 parent 5ad2353 commit 25c9cd8

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ runs:
267267
using: composite
268268
steps:
269269
- name: Install-PSModuleHelpers
270-
uses: PSModule/Install-PSModuleHelpers@ed79b6e3aa8c9cd3d30ab2bf02ea6bd4687b9c74 # v1.0.7
270+
uses: PSModule/Install-PSModuleHelpers@68e8ca76be679bfcb7099aed8cffa911c4ab72af # v1.0.8
271271

272272
- name: Get test paths
273273
shell: pwsh

src/tests/Module/PSModule/PSModule.Tests.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ Describe 'PSModule - Module tests' {
8282
$result | Should -Be $true
8383
Write-Host "$($result | Format-List | Out-String)"
8484
}
85+
It 'Module version folder matches the manifest version' {
86+
$manifest = Import-PowerShellDataFile -Path $moduleManifestPath
87+
$moduleVersionFolder = Split-Path -Path (Split-Path -Path $moduleManifestPath -Parent) -Leaf
88+
89+
$moduleVersionFolder | Should -Be $manifest.ModuleVersion.ToString()
90+
}
8591
It 'Module Manifest is valid' {
8692
$result = Test-ModuleManifest -Path $moduleManifestPath
8793
$result | Should -Not -Be $null

tests/outputTestRepo/outputs/module/PSModuleTest/PSModuleTest.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@{
22
RootModule = 'PSModuleTest.psm1'
3-
ModuleVersion = '999.0.0'
3+
ModuleVersion = '3.0.11'
44
CompatiblePSEditions = @(
55
'Core'
66
'Desktop'

0 commit comments

Comments
 (0)