Skip to content

Remove pinned Pester RequiredVersion causing test discovery failure#16

Merged
Marius Storhaug (MariusStorhaug) merged 3 commits into
mainfrom
copilot/fix-pester-test-discovery
Jul 5, 2026
Merged

Remove pinned Pester RequiredVersion causing test discovery failure#16
Marius Storhaug (MariusStorhaug) merged 3 commits into
mainfrom
copilot/fix-pester-test-discovery

Conversation

Copilot AI commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

CI Test-* jobs failed during Pester discovery with FileLoadException: Could not load file or assembly 'Pester, Version=5.7.1.0'... Assembly with same name is already loaded. The test file pinned an exact Pester version via #Requires, which conflicted with Pester 5.8.0 already loaded by the PSModule/Invoke-Pester action before discovery runs.

Changes

  • Removed the #Requires -Modules @{ ModuleName = 'Pester'; RequiredVersion = '5.7.1' } line from tests/PSCustomObject.Tests.ps1.
  • Confirmed no other test files in the repo carry a similar exact-version Pester pin.
-#Requires -Modules @{ ModuleName = 'Pester'; RequiredVersion = '5.7.1' }
-
 [Diagnostics.CodeAnalysis.SuppressMessageAttribute(

The Invoke-Pester action controls the Pester version centrally, so per-repo version pinning is redundant and causes this drift whenever Pester releases a new version. This aligns the test file with PSModule/Template-PSModule and other module repos, which carry no Pester #Requires pin.

Copilot AI changed the title [WIP] Fix test discovery failure due to Pester version conflict Remove pinned Pester RequiredVersion causing test discovery failure Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Pattern Description
^src/ Matches files where path matches this pattern
^README\.md$ Matches files where path matches this pattern

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

@MariusStorhaug Marius Storhaug (MariusStorhaug) marked this pull request as ready for review July 5, 2026 14:24
Copilot AI review requested due to automatic review settings July 5, 2026 14:24
@MariusStorhaug Marius Storhaug (MariusStorhaug) merged commit 25dd9dc into main Jul 5, 2026
28 checks passed
@MariusStorhaug Marius Storhaug (MariusStorhaug) deleted the copilot/fix-pester-test-discovery branch July 5, 2026 14:24
Copilot stopped reviewing on behalf of Marius Storhaug (MariusStorhaug) due to an error July 5, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates the PowerShell test file header by removing the explicit Pester module requirement, leaving only the suppression attribute at the top of the file.

Changes:

  • Removed #Requires -Modules pin to Pester 5.7.1 from the test file.
  • Removed a blank line that separated #Requires from the attribute block.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to 4
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSUseDeclaredVarsMoreThanAssignments', '',
Justification = 'Pester grouping syntax: known issue.'
)]
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.

Test discovery fails: pinned Pester 5.7.1 conflicts with installed Pester 5.8.0

3 participants