Skip to content

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

@katriendg

Description

@katriendg

Some unit tests need mock scope updates to specify -ModuleName LintingHelpers after the refactoring in PR #379. This is a follow-up technical debt item.

PR #379 extracted shared boilerplate functions into LintingHelpers.psm1:

  • Test-LintingFilesExist - Common "no files found" pattern
  • Write-LintingHeader - Standardized header output
  • New-LintingContext - Context creation

Unit tests that mock these functions need their mock scope updated to specify -ModuleName LintingHelpers. Without this update, mocks may not target the correct function scope.

Required Changes:

  • Review test files for scripts that use LintingHelpers functions
  • Update Mock calls to include -ModuleName LintingHelpers parameter
  • Verify tests pass with updated mock scopes

Likely Affected Test Files:

  • scripts/tests/linting/Invoke-PSScriptAnalyzer.Tests.ps1
  • scripts/tests/linting/Invoke-YamlLint.Tests.ps1
  • Any other tests mocking the extracted functions

Additional Context

Related PR: #379

Acceptance Criteria:

  • All unit tests using LintingHelpers functions specify correct -ModuleName
  • Test suite passes without warnings
  • Mock scoping follows PowerShell best practices

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions