Remove vestigial block setup/teardown#2908
Closed
nohwnd wants to merge 1 commit into
Closed
Conversation
New-EachBlockSetup, New-EachBlockTeardown and New-OneTimeBlockTeardown are only called from the runtime tests. Real Before/After go through the *Test* variants, so the Block.EachBlockSetup / OneTimeBlockSetup / EachBlockTeardown / OneTimeBlockTeardown properties are always null in a real run and the two reads in Invoke-Test are no-ops. Removes the three functions, the four Pester.Block properties, the two null reads, and the runtime tests that exercised them (the data-availability tests keep their teardown check via New-OneTimeTestTeardown). The plugin block lifecycle (OneTimeBlockSetupStart, EachBlockTeardownEnd, ...) is untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
|
About OneTimeBlock*, see #1219. Is |
nohwnd
force-pushed
the
remove-block-setup-teardown
branch
from
July 18, 2026 20:39
b5648e9 to
e8f4efc
Compare
Member
Author
|
Good point, let's keep them. The |
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.
Draft, stacked on #2907 (which is stacked on #2906). Follow up to Frode's comment on #2907.
The block level setup/teardown is dead.
New-EachBlockSetup,New-EachBlockTeardownandNew-OneTimeBlockTeardown(and the never setNew-OneTimeBlockSetupthat #2907 already removed) are only ever called from the runtime tests. RealBeforeAll/BeforeEach/AfterAll/AfterEachgo through the*Test*variants (New-OneTimeTestSetup,New-EachTestSetup, ...), so in a real run theBlock.EachBlockSetup/OneTimeBlockSetup/EachBlockTeardown/OneTimeBlockTeardownproperties are always null and the two reads inInvoke-Testare no-ops.Removes:
ScriptBlockproperties onPester.BlockInvoke-TestNew-OneTimeTestTeardown.The plugin block lifecycle (
OneTimeBlockSetupStart,EachBlockTeardownEnd, ...) is a separate, live mechanism and is untouched.These are genuinely dead so I deleted them rather than reaching for
[ExcludeFromCodeCoverage()].Minor breaking change, fine for 6.1.0.
Verification
Full
test.ps1run passes.