🪲 [Fix]: Type-accelerator tests handle modules without enums or classes#120
Merged
Merged
Conversation
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.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 8, 2026 01:45
View session
There was a problem hiding this comment.
Pull request overview
This PR fixes Pester 6 discovery failures in the module test suite by allowing It ... -ForEach blocks to accept empty enumerations, so modules without enums/classes don’t fail the entire container during discovery.
Changes:
- Add
-AllowNullOrEmptyForEachto the enum type-acceleratorItblock. - Add
-AllowNullOrEmptyForEachto the class type-acceleratorItblock.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 8, 2026 09:28
View session
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 8, 2026 09:32
View session
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 8, 2026 09:38
View session
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 8, 2026 09:43
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Module test runs now handle modules that export only one kind of public type under Pester 6. Type-accelerator checks skip empty enum or class collections instead of failing discovery, so
Test-PSModulecan validate modules that have classes without enums, enums without classes, or both.Fixed: Type-accelerator tests handle missing enum or class exports
Modules no longer fail the
Test-PSModulemodule test suite just because one type category is empty. If a module has public classes but no public enums, the enum registration check is skipped and the class registration checks still run. If a module has public enums but no public classes, the class registration check is skipped and the enum registration checks still run.This resolves the Pester 6 discovery failure caused by empty
-ForEachcollections while preserving coverage for the exported types that do exist.Technical Details
src/tests/Module/PSModule/PSModule.Tests.ps1now passes-AllowNullOrEmptyForEachto both type-acceleratorItblocks..github/workflows/Action-Test-outputs.ymlnow runs the output fixture workflow against both the existing class-only fixture and a new enum-only fixture.tests/outputEnumOnlyTestRepo/outputs/module/PSModuleEnumOnlyadds a minimal enum-only module fixture for the missing coverage path.