Skip to content

Commit 868a205

Browse files
authored
-PassThru Output is broken (#71)
PassThru now correctly outputs installed modules handled by the install engine. Fixes #70
1 parent c09c484 commit 868a205

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

ModuleFast.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,9 +1019,9 @@ function Install-ModuleFastHelper {
10191019
$installed++
10201020
Write-Verbose "$($completedJobContext.Module): Installed to $($completedJobContext.InstallPath)"
10211021
Write-Progress -Id 1 -Activity 'Install-ModuleFast' -Status "Install: $installed/$($ModuleToInstall.count) Modules" -PercentComplete ((($installed / $ModuleToInstall.count) * 50) + 50)
1022-
$context.Module.Location = $completedJobContext.InstallPath
1022+
$completedJobContext.Module.Location = $completedJobContext.InstallPath
10231023
#Output the module for potential future passthru
1024-
$context.Module
1024+
$completedJobContext.Module
10251025
}
10261026

10271027
if ($PassThru) {

ModuleFast.tests.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,12 @@ Describe 'Install-ModuleFast' -Tag 'E2E' {
736736
$actual | Should -BeLike '*incomplete installation detected*'
737737
Test-Path $incompleteItemPath | Should -BeFalse
738738
}
739-
739+
It 'PassThru has proper matching output' {
740+
$actual = Install-ModuleFast @imfParams -Specification 'PrereleaseTest=0.0.1', 'ImportExcel=7.8.6', 'PendingReboot=0.9.0.6' -PassThru
741+
($actual | Where-Object Name -EQ 'ImportExcel').ModuleVersion | Should -Be '7.8.6'
742+
($actual | Where-Object Name -EQ 'PrereleaseTest').ModuleVersion | Should -Be '0.0.1'
743+
($actual | Where-Object Name -EQ 'PendingReboot').ModuleVersion | Should -Be '0.9.0.6'
744+
}
740745
It 'PassThru only reports on installed modules' {
741746
Install-ModuleFast @imfParams -Specification 'Pester=5.4.0', 'Pester=5.4.1' -PassThru | Should -HaveCount 2
742747
Install-ModuleFast @imfParams -Specification 'Pester=5.4.0', 'Pester=5.4.1' -PassThru | Should -HaveCount 0

0 commit comments

Comments
 (0)