-
-
Notifications
You must be signed in to change notification settings - Fork 477
Closed
Description
Checklist
- Issue has a meaningful title
- I have searched the existing issues. See all issues
- I have tested using the latest version of Pester. See Installation and update guide.
What is the issue?
I'm trying to test a PowerShell module across multiple PowerShell versions.
When I try to load Pester on PowerShell 6.0.4, I get this error:
Could not load file or assembly 'System.Management.Automation, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Expected Behavior
I'd expect Pester to load.
Steps To Reproduce
I suggest reproducing with the PowerShell Core 6.0.4 Docker image:
➜ docker pull mcr.microsoft.com/powershell:6.0.4-ubuntu-16.04
➜ docker run -it mcr.microsoft.com/powershell:6.0.4-ubuntu-16.04
➜ docker run -it mcr.microsoft.com/powershell:6.0.4-ubuntu-16.04
PowerShell v6.0.4
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /> import-module pester
import-module : The specified module 'pester' was not loaded because no valid module file was found in any module directory.
At line:1 char:1
+ import-module pester
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (pester:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
PS /> Install-Module -Name Pester -Force -SkipPublisherCheck
PS /> Import-Module Pester
The following exception occurred while retrieving member "CreateRuntimeDefinedParameterDictionary": "Could not load file or assembly 'System.Management.Automation, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
"
At /usr/local/share/powershell/Modules/Pester/5.3.3/Pester.psm1:137 char:1
+ $script:AssertionDynamicParams = [Pester.Factory]::CreateRuntimeDefin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ExtendedTypeSystemException
+ FullyQualifiedErrorId : CatchFromBaseGetMember
The first Import-Module is there to show that no Pester version is installed in the machine.
As you can see from the logs, 5.3.3 is pulled and installed.
I tried other 5.x versions and I get the same error.
4.x works fine.
Describe your environment
PS /> (Invoke-WebRequest -Uri "https://git.io/JTinj" -UseBasicParsing).Content | Invoke-Expression
Pester version : 5.3.3 /usr/local/share/powershell/Modules/Pester/5.3.3/Pester.psm1
PowerShell version : 6.0.4
OS version : Unix 5.10.102.1
PS />
The Docker image runs on Windows 11, using WSL 2.
Same issue if the same code runs on Github's runners.
Possible Solution?
No response
Metadata
Metadata
Assignees
Labels
No labels