#Requires -Module error is confusing when version fails
When a #Requires -Module version requirement (ModuleVersion, MaximumVersion, RequiredVersion) is not satisfied, the error message says that the module isn't found, not that the version of the module isn't found.
This is potentially very confusing.
& : The script 'Module.Help.Tests.ps1' cannot be run because the following modules that are specified by the "#requires" statements of the script are missing: Pester.
At C:\ps-test\Test-PesterScriptParameter.ps1:18 char:3
+ & $TestPath -ModuleName PSScriptAnalyzer
+ CategoryInfo : ResourceUnavailable: (Module.Help.Tests.ps1:String) , ScriptRequiresException
+ FullyQualifiedErrorId : ScriptRequiresMissingModules
Seems useful. Probably somewhat low-priority right now, but I’ve put it in the backlog. :)
June Blender commented
You bet. Thanks for considering it.