Skip to content

Conversation

@SrBlackVoid
Copy link

Updated the Pester test suite to be compatible with v5. Known to be working with v. 5.7.1 of Pester, but minimum supported version may be 5.2 according to feature documentation.

Description

This is a rather large-scale change, but I tried to keep the following overall principles:

  • Keep as close to the original assertions as possible (only change or remove if needed)
  • Not alter existing function definitions (only exception I found to this was Get-JiraIssueLinkType, though end logic should be the same there)
  • Follow best practices (Biggest alteration was adjusting usage of InModuleScope, documented here: Testing private functions)
    • To supplement calls of public functions within test themselves, created helper functions that matched the original mock outputs

Note there are still a number of #NOTE, #WARN, and one #BUG tag where I either made changes against the original assertion setups or found a discrepancy (I can clean those up as those are confirmed).

Motivation and Context

While I was directly impacted by the recent breaking changes to the Jira API, I did notice the Pester test suite was still on the outdated v4. As noted in #517 , this could make things easier for contributors overall.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • I have added Pester Tests that describe what my changes should do.
  • I have updated the documentation accordingly.

SrBlackVoid and others added 19 commits October 1, 2025 16:59
Also serves as initial basis for how test files may need to be
reformatted.
Kept getting flagged for modifications on this one file, ended up
needing to renormalize to get EOL churn to stop.
Tried to preserve the original structure of the tests as much as
possible while converting it to v5 compatibility.
Established overall strategy for updating to Pester v5. Key elements
that may show in subsequent function test updates:
- Removing It blocks from shared functions (causes conflicts with
discovery phase) and adjusting how these functions are called
- Removing InModuleScope usage (not recommended practice)
- Adjusting mock setups & replacing Assert-MockCalled with Should
-Invoke
- Some cases of re-organizing BeforeAll/Each and Context blocks
Leaving out Get-JiraIssueLinkType as a special exception.
Get-JiraIssueLinkType was the only function (so far) that needed some
rework to remove the recursive call, which was making testing extremely
challenging.
Because these are all private functions, took a different route with
InModuleScope usage (still follows recommended guidelines).
Leaving out Invoke-JiraMethod as exception (special case)
This one put up a fight. There should be a way to not require completely
surrounding in InModuleScope, but could not get current test structure
to work without it.
Couple of ScriptAnalyzer tests and a missing mandatory parameter flag.
@SrBlackVoid SrBlackVoid requested a review from a team as a code owner November 2, 2025 00:15
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.

1 participant