Skip to content

Commit f527e23

Browse files
📖 [Docs]: Process-PSModule test phase data guidance updated (#48)
Process-PSModule documentation now clarifies how test phase data is exposed across module-local setup, test, and teardown phases. Module authors can use one `TestData` payload with consistent environment variable names in `BeforeAll`, Pester tests, and `AfterAll`, and can troubleshoot callers that rely on `secrets: inherit` without explicitly building the JSON payload. - Related: PSModule/Process-PSModule#386 ## Changed: Test phase data guidance is clearer The Process-PSModule usage guide now names the setup, test, and teardown phases that receive `TestData` keys and documents that the same environment variable names should be available in each phase. ## Fixed: Troubleshooting guidance for missing setup or teardown keys The usage guide now explains that `secrets: inherit` only forwards secrets that already exist by name. It does not build the `TestData` JSON payload from individual secrets, so callers must explicitly construct and pass that value. ## Technical Details - Updated `src/docs/Frameworks/Process-PSModule/usage.md` under the Frameworks → Process-PSModule docs. - Left the existing uncommitted `src/docs/Coding-Standards/GitHub-Actions.md` workspace change untouched. - Local validation: `.github/scripts/Test-DocumentationLink.ps1` passed.
1 parent b59e6bb commit f527e23

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • src/docs/Frameworks/Process-PSModule

‎src/docs/Frameworks/Process-PSModule/usage.md‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
"TEST_APP_ORG_CLIENT_ID": "${{ secrets.TEST_APP_ORG_CLIENT_ID }}" } }
9898
```
9999

100-
### Passing test data (secrets and variables) to the tests
100+
### Passing test phase data (secrets and variables)
101101

102102
A single `TestData` secret lets a module expose any number of caller-defined values to its test jobs
103103
(`BeforeAll-ModuleLocal`, `Test-ModuleLocal` and `AfterAll-ModuleLocal`) without changing the shared
@@ -134,6 +134,16 @@ $env:CONFLUENCE_API_TOKEN # from the "secrets" map (masked in logs)
134134
$env:CONFLUENCE_SITE # from the "variables" map (not masked)
135135
```
136136

137+
The same `TestData` keys are exported before every module-local phase runs:
138+
139+
- `BeforeAll-ModuleLocal` runs `tests/BeforeAll.ps1` before the module-local test matrix.
140+
- `Test-ModuleLocal` runs the module's Pester tests.
141+
- `AfterAll-ModuleLocal` runs `tests/AfterAll.ps1` after the module-local test matrix, including cleanup paths.
142+
143+
Setup scripts, tests, and teardown scripts should therefore use the same environment variable names.
144+
If `$env:<name>` is available in one phase but missing in another, treat that as a Process-PSModule
145+
propagation bug rather than a caller contract difference.
146+
137147
Notes:
138148

139149
- The names are caller-defined; no secret or variable names are hard-coded in the shared workflow.
@@ -161,6 +171,9 @@ Notes:
161171
- Omit `TestData` entirely when the module needs no secrets or variables. Include only the map you
162172
need (just `secrets`, just `variables`, or both).
163173
- Because `secrets: inherit` is not used, only the values you list are ever exposed.
174+
- If using `secrets: inherit` in a caller workflow, remember that GitHub only forwards secrets that
175+
already exist by name. It does not assemble a `TestData` JSON payload from individual secrets such as
176+
`TEST_USER_PAT`; the caller must still create and pass the `TestData` value explicitly.
164177
- Organization, repository and GitHub *Environment* secrets and variables are supported when they are
165178
visible to the calling job. For environment-scoped values, set `environment:` on the calling job and
166179
explicitly include those values in `TestData`; they are not exposed automatically.

0 commit comments

Comments
 (0)