pester / Pester

Pester is the ubiquitous test and mock framework for PowerShell.
https://pester.dev/
Other
3.11k stars 473 forks source link

Is it safe to delete older version of Pester module? #2570

Open Hot12345 opened 1 week ago

Hot12345 commented 1 week ago

Checklist

What is the issue?

Hi,

Im using Powershell 5.1 Have the following modules versions installed of Pester;

Which version is module is safe to delete? Or is It that the version 3.4.0 must be installed?

Expected Behavior

Hi,

Im using Powershell 5.1 Have the following modules versions installed of Pester;

Which version is module is safe to delete? Or is It that the version 3.4.0 must be installed?

Steps To Reproduce

Hi,

Im using Powershell 5.1 Have the following modules versions installed of Pester;

Which version is module is safe to delete? Or is It that the version 3.4.0 must be installed?

Describe your environment

No response

Possible Solution?

No response

Hot12345 commented 1 week ago

Name Value


PSVersion 5.1.22621.4249
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.4249
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

fflaten commented 1 week ago

Unless you run scripts specifying the version in a #requires ... statement or specify a version during Import-Module, PowerShell will use the newest version installed. In that case you can delete the older versions.

Be aware that 3.4.0 was included in Windows so you need to modify some permissions to delete it, see the note here

Hot12345 commented 1 week ago

Unless you run scripts specifying the version in a #requires ... statement or specify a version during Import-Module, PowerShell will use the newest version installed. In that case you can delete the older versions.

Be aware that 3.4.0 was included in Windows so you need to modify some permissions to delete it, see the note here

Thanks for your reply. So It doesn't harm or miss some cmdlets if I delete the module version 3.4.0? All the cmdlets are passed over to the newer module 5.x.x?

fflaten commented 6 days ago

Functionality, yes, though many commands have changed a lot due to a completely new architecture in newer versions.

v3 has been unsupported for years and isn't compatible with v5 (and the other way around). If you write tests with v5.6.1 today, just uninstall 3.4.0.

nohwnd commented 6 days ago

https://gist.github.com/nohwnd/5c07fe62c861ee563f69c9ee1f7c9688 here is a script for that if you are still having the version that came with Windows, and is locked by TrustedInstaller.