Skip to content

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

@katriendg

Description

@katriendg

Update: Issue Closed as Invalid

After deeper analysis of the module architecture, this issue is based on an incorrect premise.

Current Architecture

Module Exports
CIHelpers.psm1 Set-CIOutput, Set-CIEnv, Write-CIStepSummary, Write-CIAnnotation, etc.
LintingHelpers.psm1 Get-ChangedFilesFromGit, Get-FilesRecursive, Get-GitIgnorePatterns

Why the Proposed Change Would Break Tests

The linting scripts (Invoke-PSScriptAnalyzer.ps1, Invoke-YamlLint.ps1) import both modules directly and call CI functions at script scope—not through LintingHelpers:

Import-Module LintingHelpers.psm1 -Force
Import-Module CIHelpers.psm1 -Force

Set-CIOutput -Name "count" -Value "0"  # Direct call to CIHelpers

Adding -ModuleName LintingHelpers to mocks of Set-CIOutput would cause:

  • ❌ Mocks would NOT intercept direct script calls (only calls from within LintingHelpers)
  • ❌ Tests would fail because real CI functions would execute

Conclusion

The current session-level mocking strategy is correct for this module architecture. No changes needed.

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