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: src/docs/Frameworks/Process-PSModule/pipeline-stages.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,22 +111,24 @@ The [PSModule - SourceCode tests](https://github.com/PSModule/Process-PSModule/b
111
111
112
112
- Imports and tests the module in parallel (matrix) using Pester tests from the module repository.
113
113
- Module test files declare a Pester **6.x** requirement via `#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '6.0.0'; MaximumVersion = '6.*' }` — a convention module authors add to each `*.Tests.ps1`, not something this pipeline injects. The [Invoke-Pester](https://github.com/PSModule/Invoke-Pester) action installs a matching `6.x`, so minor and patch updates flow in automatically while a new major stays a deliberate, reviewed change.
114
-
- Supports setup and teardown scripts executed via separate dedicated jobs:
115
-
-`BeforeAll`: Runs once before all test matrix jobs to set up the test environment (e.g., deploy infrastructure, download test data).
116
-
-`AfterAll`: Runs once after all test matrix jobs complete to clean up the test environment (e.g., remove test resources, clean up databases).
117
-
- Setup/teardown scripts are automatically detected in test directories and executed with the same environment variables as the tests.
114
+
- Supports two special workflow phase scripts executed via separate dedicated jobs:
115
+
-`tests/BeforeAll.ps1`: Runs once before all module-local test matrix jobs to set up the test environment (e.g., deploy infrastructure, download test data).
116
+
-`tests/AfterAll.ps1`: Runs once after all module-local test matrix jobs complete to clean up the test environment (e.g., remove test resources, clean up databases).
117
+
- The workflow checks only those exact repository-root paths; phase detection is non-recursive. Ordinary Advanced test entries may still be discovered recursively under `tests/`, but nested files named `BeforeAll.ps1` or `AfterAll.ps1` do not create workflow phases.
118
+
- The two phase scripts run with the same environment variables as the tests.
118
119
- This produces a JSON-based report that is used by [Get-PesterTestResults](#get-test-results) evaluate the results of the tests.
119
120
120
121
### Setup and Teardown Scripts
121
122
122
123
The workflow supports automatic execution of setup and teardown scripts for module tests:
123
124
124
-
- Scripts are automatically detected and executed if present.
125
-
- If no scripts are found, the workflow continues normally.
125
+
-`tests/BeforeAll.ps1` and `tests/AfterAll.ps1` are special workflow phase files, not ordinary recursively discovered test entries.
126
+
- Each phase is enabled only when its exact file exists at the root of `tests/`.
127
+
- If either file is absent, the workflow skips that phase and continues normally.
126
128
127
129
#### Setup - `BeforeAll.ps1`
128
130
129
-
- Place in your test directories (`tests/BeforeAll.ps1`).
131
+
- Place at the exact repository-root path `tests/BeforeAll.ps1`.
130
132
- Runs once before all test matrix jobs to prepare the test environment.
131
133
- Deploy test infrastructure, download test data, initialize databases, or configure services.
132
134
- Has access to the same environment variables as your tests (secrets, GitHub token, etc.).
0 commit comments