Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

Commit 67cad66

Browse files
Allow empty -ForEach in type-accelerator tests (Pester 6 compat)
Pester 6 defaults Run.FailOnNullOrEmptyForEach to true, so the enum/class type-accelerator It blocks fail Discovery for a fixture module that has classes but no enums (or vice versa). Add -AllowNullOrEmptyForEach so an empty collection is skipped instead of failing the container. Fixes the Action-Test-outputs failure on main.
1 parent bf40a25 commit 67cad66

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/tests/Module/PSModule/PSModule.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ Describe 'PSModule - Module tests' {
9393
BeforeAll {
9494
Import-Module -Name $moduleManifestPath -Force
9595
}
96-
It 'Should register public enum [<_>] as a type accelerator' -ForEach $expectedEnumNames {
96+
It 'Should register public enum [<_>] as a type accelerator' -ForEach $expectedEnumNames -AllowNullOrEmptyForEach {
9797
$registered = [psobject].Assembly.GetType('System.Management.Automation.TypeAccelerators')::Get
9898
$registered.Keys | Should -Contain $_ -Because 'the framework registers public enums as type accelerators'
9999
}
100100

101-
It 'Should register public class [<_>] as a type accelerator' -ForEach $expectedClassNames {
101+
It 'Should register public class [<_>] as a type accelerator' -ForEach $expectedClassNames -AllowNullOrEmptyForEach {
102102
$registered = [psobject].Assembly.GetType('System.Management.Automation.TypeAccelerators')::Get
103103
$registered.Keys | Should -Contain $_ -Because 'the framework registers public classes as type accelerators'
104104
}

0 commit comments

Comments
 (0)