Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why TestExplorer in VS2015 failed to load Pester module?

I installed the Powershell Tools for Visual Studio 2015 then I created a tests.ps1 files inside my Powershell project in VS2015. the test explorer recognizes the declared test, but when I try to run the test I get this: "Result Message: Failed to load Pester module. The specified module 'Pester' was not loaded because no valid module file was found in any module directory."

VS2015

I discover that I did not have the Pester in my Pc, I download it from GitHub, then I add the folder to the $env:PSModulePath. Powershell identifies the module, but was not able to import it, so I move the folder from its original location to: c:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ Now any console of powershell is able to import the module: ISE, Powershell console, Powershell interactive window in VS2015.

Then I try to run the test again, I keep getting the same message.

like image 767
XtianGIS Avatar asked Dec 12 '25 09:12

XtianGIS


1 Answers

As I stated in my question: I added the folder with the Pester to the environment variable called PSModulePath, but I added to the end of it.

For some reason the adaptor looks for the path of module only under the first folder in that environment variable.

I changed the order and moved the path to the beginning of the string. Voila!! it works.

like image 139
XtianGIS Avatar answered Dec 15 '25 17:12

XtianGIS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!