Skip to content

Add AfterAll cleanup for stub functions in Pester tests#204

Merged
Trenly merged 2 commits intocopilot/add-pester-tests-for-installer-detectionfrom
copilot/clean-up-stubs-after-all
Mar 26, 2026
Merged

Add AfterAll cleanup for stub functions in Pester tests#204
Trenly merged 2 commits intocopilot/add-pester-tests-for-installer-detectionfrom
copilot/clean-up-stubs-after-all

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 26, 2026

  • Analyze the feedback: only remove stub functions in AfterAll if they were created by BeforeAll
  • Update BeforeAll to track which functions were added using script-scoped boolean flags
  • Update AfterAll to only remove functions that were added by BeforeAll

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

@Trenly
Copy link
Copy Markdown
Owner

Trenly commented Mar 26, 2026

@copilot The BeforeAll only creates the functions if they weren't existing before the tests - they should only be removed if they were added

Copy link
Copy Markdown
Author

Copilot AI commented Mar 26, 2026

@copilot The BeforeAll only creates the functions if they weren't existing before the tests - they should only be removed if they were added

Fixed in eb3936e. Now each function tracks whether it was created by BeforeAll using a script-scoped boolean flag (e.g. $Script:AddedGetMSITable), and AfterAll only removes functions where that flag is $true.

Copilot AI requested a review from Trenly March 26, 2026 21:28
@Trenly Trenly marked this pull request as ready for review March 26, 2026 21:28
@Trenly Trenly merged commit b66dfa5 into copilot/add-pester-tests-for-installer-detection Mar 26, 2026
@Trenly Trenly deleted the copilot/clean-up-stubs-after-all branch March 26, 2026 21:28
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