You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test-ModuleManifest erroneously requires a script-module RootModule entry to be specified with filename extension #8388
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.psd1
Expected 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)
pougetat (@pougetat): I'm personally happy for you to take this on, but since the issue hasn't been marked as up-for-grabs (yet), let's ask the powers that be; Steve Lee (@SteveL-MSFT)?
Activity
pougetat commentedon Jan 11, 2019
Hey Michael Klement (@mklement0) ,
Do you mind if I work on this bug ?
:)
mklement0 commentedon Jan 11, 2019
pougetat (@pougetat): I'm personally happy for you to take this on, but since the issue hasn't been marked as up-for-grabs (yet), let's ask the powers that be; Steve Lee (@SteveL-MSFT)?
pougetat commentedon Jan 11, 2019
Sounds good. I'll pick this up as a habit going forward.