pester / Pester

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

Throw on unbound user-provided scriptblocks #2551

Open fflaten opened 1 month ago

fflaten commented 1 month ago

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:

image

image

Fix #2411

Checklist:

PR Checklist

fflaten commented 1 month ago

Good or checking too many places? Can we improve the error somehow? Included a truncated scriptblock string to help identity the source.

Update link to https://pester.dev/docs/migrations/v5-to-v6 (when available) with workaround?