Skip to content

test(linting): update mock scoping to target LintingHelpers module#405

Closed
shaominngqing wants to merge 1 commit intomicrosoft:mainfrom
shaominngqing:fix/update-mock-scoping-396
Closed

test(linting): update mock scoping to target LintingHelpers module#405
shaominngqing wants to merge 1 commit intomicrosoft:mainfrom
shaominngqing:fix/update-mock-scoping-396

Conversation

@shaominngqing
Copy link

Description

This PR updates mock scoping in linting tests following the refactoring in #379 where shared boilerplate functions were extracted into LintingHelpers.psm1.

Without specifying -ModuleName LintingHelpers, mocks may not target the correct function scope, potentially causing test failures.

Changes

  • Added -ModuleName LintingHelpers parameter to all mocks of functions from the LintingHelpers module:
    • Get-ChangedFilesFromGit
    • Get-FilesRecursive
    • Write-GitHubAnnotation
    • Set-GitHubOutput
    • Set-GitHubEnv
    • Write-GitHubStepSummary

Files Modified

  • scripts/tests/linting/Invoke-PSScriptAnalyzer.Tests.ps1
  • scripts/tests/linting/Invoke-YamlLint.Tests.ps1

Testing

  • Verified all mock calls now include the correct module scope
  • No functional changes to test logic

Fixes #396

- Add -ModuleName LintingHelpers to all mocks of extracted functions
- Affects Get-ChangedFilesFromGit, Get-FilesRecursive, Write-GitHubAnnotation,
  Set-GitHubOutput, Set-GitHubEnv, and Write-GitHubStepSummary
- Ensures mocks target the correct function scope after refactoring in microsoft#379

Fixes microsoft#396
@shaominngqing shaominngqing requested a review from a team as a code owner February 4, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue]: Update mock scoping in linting tests to target LintingHelpers module

2 participants