Allow Test-ModuleManifest to work when RootModule has no file extension (#8687)

This commit is contained in:
pougetat
2019-03-10 14:57:19 -07:00
committed by Dongbo Wang
parent ba60904350
commit e3829cb60f
2 changed files with 70 additions and 16 deletions
@@ -67,6 +67,16 @@ Describe "Test-ModuleManifest tests" -tags "CI" {
$moduleManifest.RootModule | Should -Be $rootModuleValue
}
It "module manifest containing valid rootmodule without specifying .psm1 extension succeeds" {
$rootModuleFileName = "bar.psm1";
New-Item -ItemType File -Path testdrive:/module/$rootModuleFileName > $null
New-ModuleManifest -Path $testModulePath -RootModule "bar"
$moduleManifest = Test-ModuleManifest -Path $testModulePath -ErrorAction Stop
$moduleManifest | Should -BeOfType System.Management.Automation.PSModuleInfo
$moduleManifest.RootModule | Should -Be "bar"
}
It "module manifest containing valid processed empty rootmodule file type fails: <rootModuleValue>" -TestCases (
@{rootModuleValue = "foo.cdxml"; error = "System.Xml.XmlException"}, # fails when cmdlet tries to read it as XML
@{rootModuleValue = "foo.xaml"; error = "Modules_WorkflowModuleNotSupported"} # not supported on PowerShell Core