-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module
Description
This is a regression from Windows PowerShell.
In PS Core, a *.psm1 file referenced in a module manifest's RootModule entry must be specified with the filename extension in order for Test-ModuleManifest to consider the manifest valid.
This is at odds with:
-
current Windows PowerShell behavior
-
and, more importantly, the fact that this is not an actual requirement for being able to import and use a module.
Moreover, the error message that is issued when the extension is missing is misleading: see #6683
Steps to reproduce
# Create a manifest whose RootModule entry is a filename *without the .psm1 extension*
New-ModuleManifest (Join-Path (New-Item -Force -Type Directory tmpMod) tmpMod.psd1) -RootModule tmpMod -function foo
# Create the *.psm1 file
'function foo { "foo" }' > tmpMod/tmpMod.psm1
# Import the module and call one of its functions.
Import-Module ./tmpMod
foo
# Validate the manifest.
Test-ModuleManifest tmpMod/tmpMod.psd1Expected behavior
foo
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.0.1 tmpMod foo
Actual behavior
foo
Test-ModuleManifest : The module manifest 'tmpMod' could not be processed
because it is not a valid PowerShell module manifest file.
Remove the elements that are not permitted: /path/to/tmpMod/tmpMod.psd1
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.0.1 tmpMod foo
That is, Test-ModuleManifest unexpectedly claims that the manifest is invalid, even though it clearly isn't, as evidenced by the module having been successfully imported.
Environment data
PowerShell Core 6.2.0-preview.1 on macOS 10.14.1
PowerShell Core 6.2.0-preview.1 on Ubuntu 16.04.5 LTS
PowerShell Core 6.2.0-preview.1 on Microsoft Windows 10 Pro (64-bit; Version 1803, OS Build: 17134.345)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module