Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Throw error when Test-ModuleManifest fails in Update-ModuleManifest #398

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion Tests/PSGetUpdateModuleManifest.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down Expand Up @@ -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')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down