Skip to content

⚙️ [Maintenance]: Require Pester 6.x in test files#3

Open
Marius Storhaug (MariusStorhaug) wants to merge 2 commits into
masterfrom
maintenance/lock-pester-major-6
Open

⚙️ [Maintenance]: Require Pester 6.x in test files#3
Marius Storhaug (MariusStorhaug) wants to merge 2 commits into
masterfrom
maintenance/lock-pester-major-6

Conversation

@MariusStorhaug

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented Jul 7, 2026

Copy link
Copy Markdown
Member

Pester tests in this module now require the Pester 6.x major version, so every contributor and CI run resolves the same major and a new Pester major can't slip in and break the suite. The tests previously declared no framework requirement and ran on whatever Pester happened to be installed.

Changed: tests are locked to the Pester 6.x major

Every *.Tests.ps1 file now starts with a version-bounded requirement:

#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '6.0.0'; MaximumVersion = '6.*' }

Any Pester 6.x satisfies it, so minor and patch releases flow in automatically while moving to a new major stays a deliberate, reviewed change. No module source or behaviour changes.

Technical Details

Copilot AI review requested due to automatic review settings July 7, 2026 15:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to standardize test execution by adding an explicit Pester dependency requirement to all PowerShell test scripts in the repo, ensuring the tests run only with Pester 6.x and the expected module identity.

Changes:

  • Added #Requires -Modules to each test file to require the Pester module at >= 6.0.0.
  • Attempted to lock tests to the Pester 6.x major version via MaximumVersion.
  • Added the Pester module GUID to pin module identity.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
Tests/AzureDevOps.VariableGroups/AzureDevOps.VariableGroups.Tests.ps1 Adds a Pester #Requires directive at the top of the test file.
Tests/AzureDevOps.Tests.ps1 Adds a Pester #Requires directive to the root test file.
Tests/AzureDevOps.Packaging/AzureDevOps.Packaging.Tests.ps1 Adds a Pester #Requires directive for the packaging tests.
Tests/AzureDevOps.Common/Public/Invoke-AzureDevOpsRestMethod.Tests.ps1 Adds a Pester #Requires directive for the public function test.
Tests/AzureDevOps.Common/AzureDevOps.Common.Tests.ps1 Adds a Pester #Requires directive for the common module tests.
Tests/AzureDevOps.Account/Public/Add-AzureDevOpsAccount.Tests.ps1 Adds a Pester #Requires directive for the public function test.
Tests/AzureDevOps.Account/AzureDevOps.Account.Tests.ps1 Adds a Pester #Requires directive for the account module tests.

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

Comment thread Tests/AzureDevOps.VariableGroups/AzureDevOps.VariableGroups.Tests.ps1 Outdated
Comment thread Tests/AzureDevOps.Tests.ps1 Outdated
Comment thread Tests/AzureDevOps.Packaging/AzureDevOps.Packaging.Tests.ps1 Outdated
Comment thread Tests/AzureDevOps.Common/Public/Invoke-AzureDevOpsRestMethod.Tests.ps1 Outdated
Comment thread Tests/AzureDevOps.Common/AzureDevOps.Common.Tests.ps1 Outdated
Comment thread Tests/AzureDevOps.Account/Public/Add-AzureDevOpsAccount.Tests.ps1 Outdated
Comment thread Tests/AzureDevOps.Account/AzureDevOps.Account.Tests.ps1 Outdated
The GUID pins module identity (precise pinning), a stricter control than the lock-to-major risk appetite. Keep only the version range.
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.

2 participants