Get-ScriptBlockScope is defined in src/functions/Pester.Scoping.ps1 (line 50) but has zero call sites anywhere in the repo (src, tests, docs). A repo-wide search returns only the definition itself.
It would be useful in Test-ParameterFilter (src/functions/Mock.ps1, ~L1225) where Set-ScriptBlockScope -ScriptBlock -SessionState is called. Today comes from .SessionState of Should -Invoke, which usually equals the session state to which the filter scriptblock is bound — but not always (e.g. authoring a filter in one session state and passing it to Should -Invoke invoked from another). Pulling the session state directly off the filter scriptblock via Get-ScriptBlockScope would handle that case.
Options:
- Wire
Get-ScriptBlockScope into Test-ParameterFilter (and any other place that should respect the scriptblock's own binding)
- Or simply delete the unused function
Get-ScriptBlockScopeis defined insrc/functions/Pester.Scoping.ps1(line 50) but has zero call sites anywhere in the repo (src, tests, docs). A repo-wide search returns only the definition itself.It would be useful in
Test-ParameterFilter(src/functions/Mock.ps1, ~L1225) whereSet-ScriptBlockScope -ScriptBlock-SessionStateis called. Todaycomes from.SessionStateofShould -Invoke, which usually equals the session state to which the filter scriptblock is bound — but not always (e.g. authoring a filter in one session state and passing it toShould -Invokeinvoked from another). Pulling the session state directly off the filter scriptblock viaGet-ScriptBlockScopewould handle that case.Options:
Get-ScriptBlockScopeintoTest-ParameterFilter(and any other place that should respect the scriptblock's own binding)