Skip to content

v3.0.10

Latest

Choose a tag to compare

@github-actions github-actions released this 05 Apr 16:32
8c33371

🩹 [Patch]: Framework-generated boilerplate code now tested and covered (#113)

Module tests now validate framework-injected boilerplate — type accelerator registration and OnRemove cleanup — so code coverage reflects actual test gaps instead of penalizing module authors for untested framework code.

New: Type accelerator registration tests

When Build-PSModule injects a class exporter region, the module tests now verify that every public class and enum listed in $ExportableClasses / $ExportableEnums is registered as a type accelerator after import.

Context Framework - Type accelerator registration
  [+] Should register public class [Book] as a type accelerator
  [+] Should register public class [BookList] as a type accelerator

Modules without a class exporter region skip these tests automatically.

New: OnRemove cleanup tests

A new test verifies that when the module is removed, its type accelerators are cleaned up via the OnRemove hook — preventing type collisions when re-importing or importing a different version.

Context Framework - Module OnRemove cleanup
  [+] Should clean up type accelerators when the module is removed

Changed: IsWindows compatibility shim removed

The $IsWindows = $true PS 5.1 Desktop edition shim has been removed from Build-PSModule (see PSModule/Build-PSModule#132). The corresponding test context and test fixture output have been removed here as well. PSModule targets PowerShell LTS (7.6+) where $IsWindows is a built-in automatic variable.

Technical Details

  • PSModule.Tests.ps1: Discovery-phase variables ($hasClassExporter, $expectedClassNames, $expectedEnumNames) are computed at script scope for Pester's -Skip/-ForEach evaluation, then recomputed in a top-level BeforeAll for the Run phase. This dual-computation pattern is required because Pester v5 Discovery and Run are separate executions that don't share script-scope state.
  • PSModuleTest.psm1 (test fixture): Updated to remove the $IsWindows shim and its suppression attributes, matching the new Build-PSModule output format.
  • PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments suppressed at file level because the analyzer cannot trace variable flow across Pester's BeforeAllIt block boundaries.