pester / Pester

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

Add missing container-parameters to Data before BeforeDiscovery #2361

Closed fflaten closed 1 year ago

fflaten commented 1 year ago

PR Summary

Add default values for unused script parameters to container's Data before executing BeforeDiscovery. Avoids changes to the variables in BeforeDiscover from being captured and sent to Run-phase.

Known limitation: Changing the variable outside BeforeDiscovery/Describe/Context would still modify it in Data. Can't fix as we don't have a hook to execute code before it. Root-level code is also discouraged in Pester v5.

Fix #2359

PR Checklist