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 checks if a required module is installed but doesn't check version #7495
Commit to doing a full check of the required modules' constraints, since we're already checking they are installed
Give a better error message when a module isn't installed; it currently just says something like:
Test-ModuleManifest : The specified RequiredModules entry 'banana' in the module manifest '/home/rob/Documents/Dev/sandbox/AModule/AModule.psd1' is invalid. Try again after updating this entry with valid values.
At line:1 char:1
+ Test-ModuleManifest ./AModule.psd1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (./AModule.psd1:String) [Test-ModuleManifest], DirectoryNotFoundException
+ FullyQualifiedErrorId : Modules_InvalidRequiredModulesinModuleManifest,Microsoft.PowerShell.Commands.TestModuleManifestCommand
Provide an option to only check the validity of the manifest itself, and not whether it will work in the current session (this last point I think is part of the need to separate "Module manifests that are not well-formed" from "Module manifests that cannot be loaded in the current session"
I think for this we should keep the "can't be loaded in this session" behaviour but behind a logic change that we invoke via an additional parameter as part of the build and release process you may want to build a module that doesn't require you to have it's dependencies on the build box, but then want them when testing and using the module in realworld use.
But that is an edge case, that for example you were developing a module using an editior to develop and push off all the build, test and release to other compute resources, where required checks can be done, Example on an iPad, or Phone etc.
The WG discussed this. It is clearly a bug that the requiredModules check happens for the module, but not the version when specified. We also do not want to expand the scope of this issue to cover recursive dependencies nor a switch where Test-ModuleManifest checks the syntax vs whether it's importable which should be a separate issue if needed.
I've been working on this, keeping to the scope above: checking the version of required modules when one is specified, without recursion or a new parameter. I'll open a PR shortly. @PowerShell/powershell could you assign it to me?
Activity
tig commentedon Nov 7, 2023
I'd love it if this were fixed.
Ellestad1995 commentedon May 6, 2024
Don't close, please fix instead 👍
wisemoth commentedon Nov 3, 2024
Fix would be great
kilasuit commentedon Nov 3, 2024
I think for this we should keep the "can't be loaded in this session" behaviour but behind a logic change that we invoke via an additional parameter as part of the build and release process you may want to build a module that doesn't require you to have it's dependencies on the build box, but then want them when testing and using the module in realworld use.
But that is an edge case, that for example you were developing a module using an editior to develop and push off all the build, test and release to other compute resources, where required checks can be done, Example on an iPad, or Phone etc.
SteveL-MSFT commentedon Sep 16, 2026
The WG discussed this. It is clearly a bug that the
requiredModulescheck happens for the module, but not the version when specified. We also do not want to expand the scope of this issue to cover recursive dependencies nor a switch whereTest-ModuleManifestchecks the syntax vs whether it's importable which should be a separate issue if needed.candygoogy commentedon Oct 11, 2026
I've been working on this, keeping to the scope above: checking the version of required modules when one is specified, without recursion or a new parameter. I'll open a PR shortly. @PowerShell/powershell could you assign it to me?