@@ -686,6 +686,19 @@ Describe PowerShell.PSGet.UpdateModuleManifest -Tags 'BVT','InnerLoop' {
686
686
- expectedFullyQualifiedErrorId " InvalidPackageManagementProviders,Update-ModuleManifest"
687
687
}
688
688
689
+ # Purpose: Validate Update-ModuleManifest will throw errors when an invalid RootModule is provided
690
+ #
691
+ # Action:
692
+ # Update-ModuleManifest -RootModule [InvalidRootModule]
693
+ #
694
+ # Expected Result: Update-ModuleManifest should throw errors about the invalid RootModule
695
+ #
696
+ It UpdateModuleManifestWithInvalidRootModule {
697
+ New-ModuleManifest - path $script :testManifestPath
698
+ $RootModule = " \/"
699
+ AssertFullyQualifiedErrorIdEquals - scriptblock {Update-ModuleManifest - Path $script :testManifestPath - RootModule $InvalidRootModule } `
700
+ - expectedFullyQualifiedErrorId " ParameterArgumentValidationError,Update-ModuleManifest"
701
+ }
689
702
690
703
# Purpose: Validate Update-ModuleManifest will throw errors if the original manifest fail the Test-ModuleManifest
691
704
#
@@ -969,4 +982,23 @@ Describe PowerShell.PSGet.UpdateModuleManifest -Tags 'BVT','InnerLoop' {
969
982
Assert ($newModuleInfo.CompatiblePSEditions -contains $CompatiblePSEditions [1 ]) " CompatiblePSEditions should include $ ( $CompatiblePSEditions [1 ]) "
970
983
} `
971
984
- Skip:$ ($PSVersionTable.PSVersion -lt ' 5.1.0' )
972
- }
985
+
986
+ # Purpose : Validate Update-ModuleManifest cmdlet does not update a module manifest file with an invalid root module
987
+ # on PowerShell version greater than 5.1
988
+ #
989
+ # Action:
990
+ # Update-ModuleManifest -Path [Path] -RootModule "\/"
991
+ #
992
+ # Expected Result: Update-ModuleManifest shoyuld not update the field "RootModule" in module manifest file
993
+ #
994
+ It " UpdateModuleManifestWithInvalidRootModule" {
995
+ New-ModuleManifest - path $script :testManifestPath
996
+
997
+ $InvalidRootModule = " \/"
998
+ try { Update-ModuleManifest - Path $script :testManifestPath - RootModule $InvalidRootModule } catch {}
999
+ $newModuleInfo = Test-ModuleManifest - Path $script :testManifestPath
1000
+
1001
+ Assert ($newModuleInfo.RootModule -contains $InvalidRootModule -eq $False ) ' Module Manifest should not contain an invalid root module'
1002
+ }`
1003
+ - Skip:$ ($PSVersionTable.PSVersion -lt ' 5.1.0' )
1004
+ }
0 commit comments