Throw during Discovery when Describe/Context/It is provided $null or @() to -ForEach/TestCases to avoid silent failure.
The previous behavior, ignoring the test/block, can be achieved by setting the configuration option Run.FailOnNullOrEmptyForEach to $false.
When enabled, individual blocks or tests can be overriden to allow empty array or null by adding a new -AllowNullOrEmptyForEach parameter to Describe/Context/It, e.g. if a test is generated using external data which might be empty.
Fix #2151
PR Checklist
[x] PR has meaningful title
[x] Summary describes changes
[x] PR is ready to be merged
If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
PR Summary
Throw during Discovery when
Describe/Context/It
is provided$null
or@()
to-ForEach/TestCases
to avoid silent failure.The previous behavior, ignoring the test/block, can be achieved by setting the configuration option
Run.FailOnNullOrEmptyForEach
to$false
.When enabled, individual blocks or tests can be overriden to allow empty array or null by adding a new
-AllowNullOrEmptyForEach
parameter toDescribe/Context/It
, e.g. if a test is generated using external data which might be empty.Fix #2151
PR Checklist
Create Pull Request
to mark it as a draft. PR can be markedReady for review
when it's ready.