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-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,10 +112,11 @@ The [PSModule - SourceCode tests](https://github.com/PSModule/Process-PSModule/b
112
112
- Imports and tests the module in parallel (matrix) using module-local Pester tests.
113
113
- Discovers module-local tests recursively under `tests/`, applying the [per-directory precedence](#module-local-test-discovery) independently at every level.
114
114
- 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.
115
-
- Supports setup and teardown scripts executed via separate dedicated jobs:
116
-
-`BeforeAll`: Runs root `tests/BeforeAll.ps1` once before all test matrix jobs to set up the test environment (e.g., deploy infrastructure, download test data).
117
-
-`AfterAll`: Runs root `tests/AfterAll.ps1` once after all test matrix jobs complete to clean up the test environment (e.g., remove test resources, clean up databases).
118
-
- Setup and teardown detection is not recursive; nested files with those names are not workflow phases.
115
+
- Supports two special workflow phase scripts executed via separate dedicated jobs:
116
+
-`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).
117
+
-`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).
118
+
- The workflow checks only those exact repository-root paths; phase detection is non-recursive. This is separate from the recursive discovery of ordinary module-local test entries described below; nested files named `BeforeAll.ps1` or `AfterAll.ps1` do not create workflow phases.
119
+
- The two phase scripts run with the same environment variables as the tests.
119
120
- This produces a JSON-based report that is used by [Get-PesterTestResults](#get-test-results) to evaluate the results of the tests.
120
121
121
122
### Module-local test discovery
@@ -136,13 +137,13 @@ Every discovered artifact needs a unique prefix before its first dot because tha
136
137
137
138
The workflow supports automatic execution of setup and teardown scripts for module tests:
138
139
139
-
-The exact root paths `tests/BeforeAll.ps1` and `tests/AfterAll.ps1` are detected and executed if present.
140
-
-If no scripts are found, the workflow continues normally.
141
-
-Detection is not recursive.
140
+
-`tests/BeforeAll.ps1` and `tests/AfterAll.ps1` are special workflow phase files, not ordinary recursively discovered test entries.
141
+
-Each phase is enabled only when its exact file exists at the root of `tests/`.
142
+
-If either file is absent, the workflow skips that phase and continues normally.
142
143
143
144
#### Setup - `BeforeAll.ps1`
144
145
145
-
- Place at the root test path `tests/BeforeAll.ps1`.
146
+
- Place at the exact repository-root path `tests/BeforeAll.ps1`.
146
147
- Runs once before all test matrix jobs to prepare the test environment.
147
148
- Deploy test infrastructure, download test data, initialize databases, or configure services.
148
149
- Has access to the same environment variables as your tests (secrets, GitHub token, etc.).
0 commit comments