PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.67k stars 478 forks source link

Need a way to choose between Pester v4 and v5 when both versions are installed #3478

Open johndog opened 2 years ago

johndog commented 2 years ago

Prerequisites

Summary

Pester v5 represents a breaking change. .test.ps1 scripts which run correctly for v5 do not run correctly for v4 and vice-versa. A user may need to run tests written against both Pester versions, and have both versions of pester installed. The InvokePesterStub will currently only load the latest one. It does seem to have an option to require version 5, but there is no similar option to require version 4, and there is no UI mechanism for triggering those constraints anyway.

Proposed Design

  1. Minimum: Provide a setting to choose the default pester version, and change InvokePesterStub to use the default
  2. Alternative 1: Provide separate "Run all v5 tests" and "Run all v4 tests" commands
  3. Ideal Alternative: Enable InvokePesterStub to detect the correct version based on the content of the loaded file, rather than using the default.

In all cases, the stub must unload the previously loaded module if it is different than the required module.

andyleejordan commented 2 years ago

This would be great to see, but it's not on our current timeline as we are focussing on stability improvements. I'm going to mark this up-for-grabs.