feat(tests): add Pester tests for LintingHelpers and Validate-MarkdownFrontmatter (#197, #198)#205
Merged
WilliamBerryiii merged 14 commits intomainfrom Jan 19, 2026
Merged
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive Pester 5.x unit tests for the LintingHelpers.psm1 module, providing coverage for all 7 exported functions. The test suite validates git integration, file enumeration, gitignore pattern parsing, and GitHub Actions workflow command functions using proper mocking patterns.
Changes:
- Added 41 test cases across 7 describe blocks covering all exported functions in LintingHelpers.psm1
- Implemented proper mocking for git commands with LASTEXITCODE handling
- Utilized existing GitMocks.psm1 module for GitHub Actions environment simulation
WilliamBerryiii
added a commit
that referenced
this pull request
Jan 17, 2026
- Add third fallback test (merge-base + HEAD~1 fail) - Add git diff failure test (LASTEXITCODE -ne 0) - Add exception handling test (catch block coverage) - Fix assertion precision with platform-aware separators - Update comment to be platform-neutral Addresses review comments on PR #205
- add tests for Get-ChangedFilesFromGit, Get-FilesRecursive, Get-GitIgnorePatterns - add tests for Write-GitHubAnnotation, Set-GitHubOutput, Set-GitHubEnv - add tests for Write-GitHubStepSummary with GitHub Actions context handling - leverage GitMocks.psm1 for environment simulation 🧪 - Generated by Copilot
- Add third fallback test (merge-base + HEAD~1 fail) - Add git diff failure test (LASTEXITCODE -ne 0) - Add exception handling test (catch block coverage) - Fix assertion precision with platform-aware separators - Update comment to be platform-neutral Addresses review comments on PR #205
…downFrontmatter - add custom PowerShell classes for FrontmatterResult, SchemaValidationResult, ValidationResult, FileTypeInfo - add ConvertFrom-YamlFrontmatter and Get-FileTypeInfo pure helper functions - add -Content parameter to Get-MarkdownFrontmatter for testing without file I/O - add comprehensive docstrings with OutputType attributes on all functions 🧪 - Generated by Copilot
- Add comprehensive Pester test suite covering all 8 exported functions - Create 7 fixture files for frontmatter validation scenarios - Fix regex escaping order in Get-SchemaForFile (escape dots before glob conversion) Closes #198 🧪 - Generated by Copilot
…tion tests - add npm run test:ps script for running Pester tests - add Initialize-JsonSchemaValidation test coverage 🧪 - Generated by Copilot
…ures - add ExcludePaths parameter to Validate-MarkdownFrontmatter.ps1 script and function - exclude scripts/tests/Fixtures/* from frontmatter and markdown linting - normalize Windows backslash paths for cross-platform pattern matching 🔧 - Generated by Copilot
📝 - Generated by Copilot
🔧 - Generated by Copilot
- update workflow to use ** for recursive matching in subdirectories - fix npm script to use -Command for proper array parameter parsing - remove duplicate Initialize-JsonSchemaValidation test region 🔧 - Generated by Copilot
- Add ExcludePaths check to the Files code path used by ChangedFilesOnly mode - Previously ExcludePaths filtering only applied when using Paths parameter - CI uses ChangedFilesOnly which populates Files, so exclusions were ignored 🔧 - Generated by Copilot
e39d58e to
5a69873
Compare
- remove unreachable duplicate elseif block in Get-SchemaForFile - add descriptive comments for pattern matching logic - remove UTF-8 BOM from test file 🧹 - Generated by Copilot
- file contains non-ASCII characters requiring BOM encoding 🔧 - Generated by Copilot
agreaves-ms
approved these changes
Jan 19, 2026
katriendg
approved these changes
Jan 19, 2026
6 tasks
WilliamBerryiii
pushed a commit
that referenced
this pull request
Jan 28, 2026
🤖 I have created a release *beep* *boop* --- ## [2.0.0](hve-core-v1.1.0...hve-core-v2.0.0) (2026-01-28) ### ⚠ BREAKING CHANGES * **agents:** add Task Reviewer and expand RPI to 4-phase workflow ([#277](#277)) ### ✨ Features * **agents:** add hve-core-installer agent to extension package ([#297](#297)) ([c0e48c6](c0e48c6)) * **agents:** add Task Reviewer and expand RPI to 4-phase workflow ([#277](#277)) ([ae76cab](ae76cab)) * **build:** add code coverage reporting to Pester workflow ([#230](#230)) ([a34822a](a34822a)) * **docs:** add GOVERNANCE.md for OSSF Silver Badge compliance ([#235](#235)) ([b0e752c](b0e752c)) * **docs:** add ROADMAP.md for OSSF Silver badge compliance ([#238](#238)) ([4a41c16](4a41c16)) * **mcp:** add MCP server configuration guidance and installer enhancements ([#225](#225)) ([0bce418](0bce418)) * **scripts:** add YAML linting with actionlint ([#234](#234)) ([d9301f9](d9301f9)) * **security:** add OpenSSF Scorecard workflow and badge ([#271](#271)) ([7c6d788](7c6d788)) * **skills:** add video-to-gif conversion skill with FFmpeg two-pass optimization ([#247](#247)) ([8d65c42](8d65c42)) * **tests:** add Pester tests for LintingHelpers and Validate-MarkdownFrontmatter ([#197](#197), [#198](#198)) ([#205](#205)) ([51ae563](51ae563)) ### 🐛 Bug Fixes * **build:** detect table formatting changes via git diff ([#261](#261)) ([985eee0](985eee0)) * **build:** disable MD024 lint rule in CHANGELOG for release-please ([#220](#220)) ([971df94](971df94)) * **build:** quote shell variables and group redirects in workflow files ([#299](#299)) ([3372509](3372509)) * **build:** resolve scorecard badge and workflow security issues ([#301](#301)) ([aeaed13](aeaed13)) * **extension:** remove frontmatter from README and exclude from markdown linting ([#223](#223)) ([4272529](4272529)) * **instructions:** quote applyTo glob pattern for YAML compatibility ([#216](#216)) ([085199c](085199c)) * **scripts:** add FooterExcludePaths parameter to frontmatter validation ([#334](#334)) ([64db98d](64db98d)) * **scripts:** add GHSA word and logs/ exclusion to cspell config ([#214](#214)) ([5c99b3f](5c99b3f)) * **scripts:** correct type assertions in Invoke-YamlLint.Tests.ps1 ([#332](#332)) ([af7050d](af7050d)) * **scripts:** eliminate false positives in dependency pinning npm pattern ([#273](#273)) ([ccbdfa3](ccbdfa3)) * **security:** add artifact attestation for signed releases ([#257](#257)) ([c52d6e2](c52d6e2)) * standardize markdown footers and complete frontmatter ([#217](#217)) ([b4e7556](b4e7556)) ### 📚 Documentation * add OpenSSF Best Practices Passing badge to README ([#239](#239)) ([91bc529](91bc529)) * **architecture:** add architecture documentation and value proposition ([#252](#252)) ([0e4b02f](0e4b02f)) * **contributing:** add testing requirements for OSSF compliance ([#254](#254)) ([4db1a18](4db1a18)) * **docs:** add enterprise status badges to README header ([#270](#270)) ([ccb68a4](ccb68a4)) * **security:** add security assurance case and threat model for OSSF Silver ([#259](#259)) ([a390e26](a390e26)) ### ♻️ Refactoring * **application:** wrap execution with try blocks, ensure proper … ([#296](#296)) ([35c4417](35c4417)) * **scripts:** extract frontmatter validation to testable module ([#293](#293)) ([4e8707e](4e8707e)) * **scripts:** extract pure functions for Pester testability ([#221](#221)) ([d40e742](d40e742)) ### 🔧 Maintenance * **deps-dev:** bump cspell from 9.4.0 to 9.6.0 in the npm-dependencies group ([#208](#208)) ([855914b](855914b)) * **deps-dev:** bump cspell from 9.6.0 to 9.6.1 in the npm-dependencies group ([#294](#294)) ([1e45ad6](1e45ad6)) * **deps:** bump actions/setup-node from 6.1.0 to 6.2.0 in the github-actions group ([#209](#209)) ([c4c69e2](c4c69e2)) * **deps:** bump the github-actions group with 4 updates ([#295](#295)) ([d8337b8](d8337b8)) * remove step-security/harden-runner from workflows ([#246](#246)) ([c5708d8](c5708d8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: hve-core-release-please[bot] <254602402+hve-core-release-please[bot]@users.noreply.github.com>
This was referenced Jan 28, 2026
This was referenced Feb 6, 2026
This was referenced Feb 13, 2026
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.
Description
This PR adds comprehensive Pester test coverage for the linting modules, implementing 104 tests across two test suites:
The implementation also includes a production bug fix for regex escaping order in
Get-SchemaForFile.Key Changes
LintingHelpers Tests (#197):
Get-ChangedFilesFromGit,Get-FilesRecursive,Get-GitIgnorePatternsWrite-GitHubAnnotation,Set-GitHubOutput,Set-GitHubEnv,Write-GitHubStepSummaryGitMocks.psm1for environment simulationValidate-MarkdownFrontmatter Tests (#198):
ConvertFrom-YamlFrontmatter,Get-MarkdownFrontmatter,Get-FileTypeInfo,Test-MarkdownFooterGet-SchemaForFile,Test-JsonSchemaValidation,Get-ChangedMarkdownFileGroup,Test-FrontmatterValidationGet-SchemaForFile- dots are now escaped BEFORE glob conversionValidationResult,SchemaValidationResult,FileTypeInfo,FrontmatterResult)Related Issue(s)
Closes #197
Closes #198
Type of Change
Sample Prompts
Not applicable - infrastructure/testing changes.
Testing
Test Results
All 104 tests pass:
Test Coverage Summary
Get-ChangedFilesFromGitGet-FilesRecursiveGet-GitIgnorePatternsWrite-GitHubAnnotationSet-GitHubOutputSet-GitHubEnvWrite-GitHubStepSummaryConvertFrom-YamlFrontmatterGet-MarkdownFrontmatterGet-FileTypeInfoTest-MarkdownFooterGet-SchemaForFileTest-JsonSchemaValidationGet-ChangedMarkdownFileGroupTest-FrontmatterValidationRequired Checks
Security Considerations
Additional Notes
Schema Validation Mode
Schema validation operates in soft/advisory mode - schema errors produce warnings rather than build failures. Tests are designed with this expectation.
Production Bug Fixed
The regex escaping bug in
Get-SchemaForFilecaused patterns likedocs/**/*.mdto fail matching because the dot in.mdwas being escaped after the glob-to-regex conversion, resulting in invalid patterns likedocs/.*/.*.mdinstead ofdocs/.*/.*\.md.Files Changed
scripts/linting/Modules/LintingHelpers.psm1scripts/linting/Validate-MarkdownFrontmatter.ps1scripts/tests/Modules/LintingHelpers.Tests.ps1scripts/tests/Modules/Validate-MarkdownFrontmatter.Tests.ps1scripts/tests/Mocks/GitMocks.psm1scripts/tests/Fixtures/Frontmatter/*.md🧪 - Generated by Copilot