-
Notifications
You must be signed in to change notification settings - Fork 125
Closed
Labels
configurationConfiguration files and settingsConfiguration files and settingsenhancementNew feature or requestNew feature or requestfoundationCore infrastructure and foundational componentsCore infrastructure and foundational componentsscriptsPowerShell, Bash, or Python scriptsPowerShell, Bash, or Python scriptstoolingDeveloper tooling and utilitiesDeveloper tooling and utilities
Description
Summary
Create the foundational Pester test infrastructure including directory structure, configuration file, and shared mock utilities. This enables all subsequent test file PRs.
Parent Issue: #190
Requirements
- Create
scripts/tests/directory structure with subdirectories for each script category - Add Pester 5.x configuration file (
scripts/tests/pester.config.ps1) - Create shared Git CLI mock module (
scripts/tests/Mocks/GitMocks.psm1) - Add test fixtures directory with
.gitkeepplaceholders - Update
.gitignorefor test output files (if needed)
Implementation Details
Directory Structure
scripts/tests/
├── pester.config.ps1 # Pester 5.x configuration
├── Mocks/
│ └── GitMocks.psm1 # Git CLI and GitHub env mocking
├── Fixtures/
│ └── .gitkeep # Test fixture files
├── linting/
│ └── .gitkeep
├── security/
│ └── .gitkeep
├── dev-tools/
│ └── .gitkeep
└── extension/
└── .gitkeep
Pester Configuration
Key configuration requirements:
Run.Exit = $truefor CI integrationTestResult.OutputFormat = 'NUnitXml'for GitHub annotationsTestResult.OutputPath→logs/pester-results.xmlOutput.CIFormat = 'GithubActions'for PR annotationsCodeCoverage.Enabled = $false(enabled in stretch goal)
Git Mock Module
The mock module should provide:
New-GitMockEnvironment- Set GITHUB_BASE_REF, GITHUB_HEAD_REF, GITHUB_ACTIONSRemove-GitMockEnvironment- Clean up environment variablesNew-MockGitDiffOutput- Generate mock git diff output
Acceptance Criteria
-
scripts/tests/pester.config.ps1exists and returns valid PesterConfiguration -
scripts/tests/Mocks/GitMocks.psm1exports mocking functions - Subdirectories created for linting, security, dev-tools, extension
- Configuration can be loaded by Pester:
Invoke-Pester -Configuration (. scripts/tests/pester.config.ps1) - All new files follow PSScriptAnalyzer rules
Dependencies
- None (first PR in sequence)
Estimated Effort
1-2 hours
Additional Context
Code Examples
See research document for complete implementation examples:
- Pester configuration patterns from Pester 5.x documentation
- Git mock module examples
Related Issues
- Blocks: All other Pester testing sub-issues ([Issue]: Add Pester unit testing framework for PowerShell scripts #190 sub-issues 2-9)
- Parent: [Issue]: Add Pester unit testing framework for PowerShell scripts #190
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
configurationConfiguration files and settingsConfiguration files and settingsenhancementNew feature or requestNew feature or requestfoundationCore infrastructure and foundational componentsCore infrastructure and foundational componentsscriptsPowerShell, Bash, or Python scriptsPowerShell, Bash, or Python scriptstoolingDeveloper tooling and utilitiesDeveloper tooling and utilities