This directory contains Pester tests for the YamlCreate.InstallerDetection PowerShell module.
The test suite validates the functionality of the installer detection module, which provides functions to:
- Parse PE file structures
- Detect various installer types (ZIP, MSIX, MSI, WIX, Nullsoft, Inno, Burn)
- Identify font files
- Resolve installer types from file paths
- PowerShell 7.0 or later
- Pester 5.x (included with PowerShell 7+)
From the module directory, run:
Invoke-Pester -Path ./YamlCreate.InstallerDetection.Tests.ps1For more detailed test output:
Invoke-Pester -Path ./YamlCreate.InstallerDetection.Tests.ps1 -Output DetailedTo see code coverage metrics:
Invoke-Pester -Path ./YamlCreate.InstallerDetection.Tests.ps1 -CodeCoverage ./YamlCreate.InstallerDetection.psm1The test suite is organized into the following sections:
- Module import validation
- Exported functions verification
- Get-OffsetBytes: Tests for byte array extraction with various offsets and endianness
- Get-PESectionTable: Tests for PE file parsing
- Test-IsZip: Tests for ZIP file detection
- Test-IsMsix: Tests for MSIX/APPX detection
- Test-IsMsi: Tests for MSI installer detection
- Test-IsWix: Tests for WIX installer detection
- Test-IsNullsoft: Tests for Nullsoft installer detection
- Test-IsInno: Tests for Inno Setup installer detection
- Test-IsBurn: Tests for Burn installer detection
- Test-IsFont: Tests for font file detection (TTF, OTF, TTC)
- Resolve-InstallerType: Tests for the main installer type resolution function
Some tests are skipped due to complexity or external dependencies:
- ZIP Archive Tests: Tests that require complete valid ZIP archives are skipped as they would need complex ZIP structure generation
- PE File Tests: Some PE-related tests are skipped when they would require reading non-existent files
- External Dependencies: The module relies on external commands (
Get-MSITable,Get-MSIProperty,Get-Win32ModuleResource) that are stubbed in the test environment
Current test coverage includes:
- 32 passing tests
- 3 skipped tests (require complex setup)
- Covers all 11 exported functions
- Tests both positive and negative scenarios
- Validates edge cases and error handling
When adding new functions to the module:
- Add corresponding tests to
YamlCreate.InstallerDetection.Tests.ps1 - Follow the existing test structure (Describe → Context → It blocks)
- Use descriptive test names that explain what is being tested
- Include both positive and negative test cases
- Clean up any temporary files created during tests