You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/instructions/tests.instructions.md
+58-32Lines changed: 58 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
description: "Use when writing, editing, or reviewing Pester test files under the tests/ folder. Covers shared repository setup, auth case iteration, naming conventions, and skip patterns for the GitHub module integration tests."
2
+
description: "Use when writing, editing, or reviewing Pester test files under the tests/ folder. Covers per-test-file repository setup, self-contained test lifecycle, auth case iteration, naming conventions, and skip patterns for the GitHub module integration tests."
3
3
applyTo: "tests/**"
4
4
---
5
5
# Integration Test Conventions
@@ -22,9 +22,17 @@ Secrets:
22
22
23
23
### APP_ENT — PSModule Enterprise App
24
24
25
-
Homed in `MSX`. ClientID: `Iv23lieHcDQDwVV3alK1`.
25
+
Homed in `MSX` (enterprise slug: `msx`). ClientID: `Iv23lieHcDQDwVV3alK1`.
26
26
Installed on [psmodule-test-org3](https://github.com/orgs/psmodule-test-org3) (enterprise org) with all permissions and push events.
27
27
28
+
Required enterprise-scoped permissions (configured on the app):
29
+
30
+
-`enterprise_organization_installations: write` — required by `Install-GitHubApp` on enterprise-owned organizations
-`$id` must always be `$env:GITHUB_RUN_ID` — never `[guid]::NewGuid()` or `Get-Random`.
194
216
- Skip repo-dependent tests with `-Skip:($OwnerType -in ('repository', 'enterprise'))`.
195
217
- Disconnect all sessions in `AfterAll`: `Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent`.
196
-
- Test-specific ephemeral resources (releases, secrets, variables, environments, teams) are created and
197
-
cleaned up within each test file. Only repositories are shared.
198
-
-`Repositories.Tests.ps1` is the exception — it creates and deletes its own repos because it tests CRUD.
218
+
- Each test file uses its own repository: `{TestName}-{OS}-{TokenType}-{RunID}`. No two test files share a repository.
219
+
- Each test file is self-contained and responsible for its own setup and teardown:
220
+
-**BeforeAll (per-context):** Ensure the repository exists via `Set-GitHubRepository`. Clean up stale test-specific resources from prior runs (re-runs with the same `GITHUB_RUN_ID`).
221
+
-**AfterAll (per-context):** Remove all test-specific resources created during the run (environments, releases, secrets, variables, etc.).
222
+
- Any individual test file or auth context can be re-run independently. Tests must not assume clean initial state — they must be idempotent.
223
+
- Tests run in parallel across OSes (Linux, macOS, Windows) and in sequence across auth contexts (7 cases). Resource names must include enough dimensions to prevent collisions across all parallel and sequential axes.
224
+
-`Repositories.Tests.ps1` is independent — it creates and deletes its own repos because it tests CRUD.
0 commit comments