Revive or retire disabled test suites#2764
Merged
Merged
Conversation
Three .Tests.ps1 suites were disabled with a top-level `return`, so Invoke-Pester discovered them but ran zero tests. - Environment.Tests.ps1: revived. Replace obsolete Mock-based fakes with the $SafeCommands override pattern (Pester internals call & $SafeCommands['Get-Variable'], which bypasses Mock) and align with the PS <7 => Windows threshold from #2735. - Describe.Tests.ps1: remove the dead Pester v4 second half that exercised DescribeImpl / New-PesterState -Path / EnterTestGroup, all removed from src. - TestsRunningInCleanRunspace.Tests.ps1: delete this Pester v4 Start-Job fossil after migrating its still-unique scenarios (output swallowing, It-without-scriptblock, graceful syntax-error handling) into modern in-process tests in Pester.RSpec.ts.ps1. - SetupTeardown.Tests.ps1: update a stale comment that referenced the deleted suite. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A sweep for production-quality test hygiene turned up three
.Tests.ps1suites disabled with a top-levelreturn—Invoke-Pesterdiscovered them but ran zero tests, so they were silent dead weight. This revives the ones that still apply and retires the ones that don't.Changes
Environment.Tests.ps1— revived (9 pass / 1 Windows-only skip). The old suite relied onMock, but Pester's internals call& $SafeCommands['Get-Variable'], which bypassesMock. Rewrote it to override the$SafeCommandsentry (fakingPSVersionTable/IsWindowsetc. and restoring infinally), and aligned with the PS<7→Windowsthreshold from Remove code specifically for PS 2.0-5.0 #2735 (PS 6 is EOL).Describe.Tests.ps1— removed dead v4 half (3 live tests remain). The post-returnblock exercisedDescribeImpl/New-PesterState -Path/EnterTestGroup, all long gone fromsrc.TestsRunningInCleanRunspace.Tests.ps1— migrated then deleted. A Pester v4Start-Jobfossil (Set-TestInconclusive,Invoke-Pester -Strict, dash-lessShould Be, v4 NUnit schema). I checked each scenario against Pester 6 behavior and migrated the genuinely-unique, still-valid ones into modern in-process tests inPester.RSpec.ts.ps1:-PassThru)Itwithout aScriptBlockfails the runRedundant scenarios (skip counts, PassThru counts, NUnit format, setup/teardown failure) were dropped as already covered elsewhere; the obsolete v4 "Strict mode" scenario was dropped outright.
SetupTeardown.Tests.ps1— updated a stale comment that pointed at the deleted suite (now points toPester.Runtime.ts.ps1).Verification
Pester.RSpec.ts.ps1: 116/116 pass (including the 4 migrated tests)Environment.Tests.ps1+Describe.Tests.ps1: 12 pass / 1 skip / 0 faildtfocus-tests left behind; no dangling references to the deleted file.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com