diff --git a/Tests/PSGetUpdateModuleManifest.Tests.ps1 b/Tests/PSGetUpdateModuleManifest.Tests.ps1 index 9c146236..e22a8c51 100644 --- a/Tests/PSGetUpdateModuleManifest.Tests.ps1 +++ b/Tests/PSGetUpdateModuleManifest.Tests.ps1 @@ -686,6 +686,25 @@ Describe PowerShell.PSGet.UpdateModuleManifest -Tags 'BVT','InnerLoop' { -expectedFullyQualifiedErrorId "InvalidPackageManagementProviders,Update-ModuleManifest" } + # Purpose: Validate Update-ModuleManifest will throw errors when an invalid RootModule is provided + # + # Action: + # Update-ModuleManifest -Path [Path] -RootModule [InvalidRootModule] + # + # Expected Result: Update-ModuleManifest should throw errors about the invalid RootModule + # + It UpdateModuleManifestWithInvalidRootModule { + + New-ModuleManifest -path $script:testManifestPath + + $InvalidRootModule = "\/" + AssertFullyQualifiedErrorIdEquals -scriptblock {Update-ModuleManifest -Path $script:testManifestPath -RootModule $InvalidRootModule} ` + -expectedFullyQualifiedErrorId "UpdateManifestFileFail,Update-ModuleManifest" + + $newModuleInfo = Test-ModuleManifest -Path $script:testManifestPath + Assert ($newModuleInfo.RootModule -contains $InvalidRootModule -eq $False) 'Module Manifest should not contain an invalid root module' + }` + -Skip:$($PSVersionTable.PSVersion -lt '5.1.0') # Purpose: Validate Update-ModuleManifest will throw errors if the original manifest fail the Test-ModuleManifest # @@ -969,4 +988,4 @@ Describe PowerShell.PSGet.UpdateModuleManifest -Tags 'BVT','InnerLoop' { Assert ($newModuleInfo.CompatiblePSEditions -contains $CompatiblePSEditions[1]) "CompatiblePSEditions should include $($CompatiblePSEditions[1])" } ` -Skip:$($PSVersionTable.PSVersion -lt '5.1.0') -} \ No newline at end of file +} diff --git a/src/PowerShellGet/public/psgetfunctions/Update-ModuleManifest.ps1 b/src/PowerShellGet/public/psgetfunctions/Update-ModuleManifest.ps1 index daa73d03..d552306a 100644 --- a/src/PowerShellGet/public/psgetfunctions/Update-ModuleManifest.ps1 +++ b/src/PowerShellGet/public/psgetfunctions/Update-ModuleManifest.ps1 @@ -922,7 +922,7 @@ function Update-ModuleManifest #Verify the new module manifest is valid $testModuleInfo = Microsoft.PowerShell.Core\Test-ModuleManifest -Path $tempPath ` - -Verbose:$VerbosePreference ` + -Verbose:$VerbosePreference ` -ErrorAction Stop } #Catch the exceptions from Test-ModuleManifest catch