🩹 [Patch]: Consolidate test setup/teardown tasks#541
Draft
Conversation
Copilot started work on behalf of
Marius Storhaug (MariusStorhaug)
January 5, 2026 22:58
View session
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Consolidate test setup and teardown tasks
Add BeforeAll/AfterAll scripts for centralized test resource cleanup
Jan 5, 2026
- Created TEMPLATE.ps1 for structuring tests with Pester. - Implemented Teams.Tests.ps1 to test GitHub Teams API functionalities including team creation, retrieval, updating, and deletion. - Developed Users.Tests.ps1 to validate user-related API calls, including user retrieval and updates. - Added Variables.Tests.ps1 to test GitHub variable management across different scopes (organization, repository, environment). - Included necessary suppressions for Pester warnings and established logging for better output visibility during test execution.
- Created TEMPLATE.ps1 for structuring Pester tests with common setup. - Implemented Teams.Tests.ps1 to test GitHub Teams API functionalities including team creation, retrieval, updating, and deletion. - Developed Users.Tests.ps1 to validate user-related API calls, including user retrieval and updates. - Added Variables.Tests.ps1 to test GitHub repository and organization variable management, including creation, updating, and removal of variables.
…in BeforeAll script
… in AfterAll script
ad98f64 to
3dbdfc3
Compare
…t/consolidate-test-setup-tasks
Contributor
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
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. |
Contributor
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test infrastructure now uses shared global setup and teardown scripts (
BeforeAll.ps1/AfterAll.ps1) that run once before and after all parallel test jobs. This reduces duplicate API calls across test files, lowers the risk of rate limiting, and provides a consistent test environment. Test files that are not yet migrated to the new pattern are parked intmp/until they are updated.Global setup and teardown
New
tests/BeforeAll.ps1andtests/AfterAll.ps1scripts handle shared test infrastructure:Test-{OS}-{TokenType}-{RunID}).Migrated test file
tests/Environments.Tests.ps1has been updated to consume the shared repository instead of creating its own:Get-GitHubRepositoryto reference the pre-created repo.Parked (unmigrated) test files
The following test files have been moved to
tmp/and will be migrated in follow-up work:Minor cleanup was applied to
Emojis.Tests.ps1,Enterprise.Tests.ps1, andUsers.Tests.ps1(movedConnect-GitHubAppintoBeforeAll, removed stale comment blocks).