Throw on unbound user-provided scriptblocks#2551
Merged
Merged
Conversation
Collaborator
Author
|
Good or checking too many places? Update link to https://pester.dev/docs/migrations/v5-to-v6 (when available) with workaround? |
nohwnd
reviewed
Oct 1, 2024
nohwnd
reviewed
Oct 1, 2024
Member
|
The PR looks great. There is some merge conflict |
99bb0fa to
308e451
Compare
…ial issues Co-authored-by: Jakub Jareš <me@jakubjares.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.
PR Summary
Throws when user provides scriptblocks that are not bound to a session state. They would be executed in Pester's module state which could cause unexpected behaviour.
Examples:
Fix #2411
Checklist:
Add-AssertionOperator -Test(type:ScriptBlock)Add-ShouldOperator -Test(type:ScriptBlock)AfterAll -Scriptblock(type:ScriptBlock)AfterEach -Scriptblock(type:ScriptBlock)BeforeAll -Scriptblock(type:ScriptBlock)BeforeDiscovery -ScriptBlock(type:ScriptBlock)BeforeEach -Scriptblock(type:ScriptBlock)Context -Fixture(type:ScriptBlock)Describe -Fixture(type:ScriptBlock)InModuleScope -ScriptBlock(type:ScriptBlock)It -Test(type:ScriptBlock)Mock -MockWith(type:ScriptBlock)Mock -ParameterFilter(type:ScriptBlock)New-PesterContainer -ScriptBlock(type:ScriptBlock[])Should-All -FilterScript(type:ScriptBlock)Should-Any -FilterScript(type:ScriptBlock)Should-Throw -ScriptBlock(type:ScriptBlock)Run.ScriptblockRun.ContainerPR Checklist
Create Pull Requestto mark it as a draft. PR can be markedReady for reviewwhen it's ready.