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
feat(#194): update guidance for Test-NovaBuild usage
- Add documentation for using Test-NovaBuild as the authoritative test entrypoint
- Update instructions to prohibit direct Invoke-Pester calls in Nova-managed projects
- Revise various documentation files to reflect the new testing policy
Copy file name to clipboardExpand all lines: .github/agents/powershell-developer.agent.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,7 @@ Implement PowerShell command and helper changes in the NovaModuleTools style.
45
45
- Preserve existing command names, warning semantics, and output shape.
46
46
- Keep new or heavily changed source functions inside the warning thresholds from `.github/instructions/code-quality-matrix.instructions.md` unless the scope explicitly justifies otherwise.
47
47
- Prefer `./scripts/build/Invoke-ScriptAnalyzerCI.ps1` and `./run.ps1` for normal analyzer loops; use direct `Invoke-ScriptAnalyzer` only for focused local checks that reuse the repository-approved settings.
48
+
- Validate Nova-managed project tests through `Test-NovaBuild`; do not call `Invoke-Pester` directly.
48
49
- When help files change, keep `docs/NovaModuleTools/en-US/*.md` valid for `Import-MarkdownCommandHelp`: use `New-MarkdownCommandHelp` for new files, `Update-MarkdownCommandHelp` after command-surface changes, and `Test-MarkdownCommandHelp` before handoff. A new public `src/public/*.ps1` file is not done until its matching help file exists.
49
50
50
51
## Definition of done
@@ -53,6 +54,7 @@ Implement PowerShell command and helper changes in the NovaModuleTools style.
53
54
- Build output still comes from Nova-generated `dist/` files, not hand-authored module files in `src/`.
54
55
- Public/private file ownership still follows the one externally called function per file rule.
55
56
- Every new public entry point has its matching help file.
57
+
- Project test validation ran through `Test-NovaBuild`.
56
58
- Any ScriptAnalyzer findings reported by `run.ps1` or `Invoke-ScriptAnalyzerCI.ps1` are resolved.
57
59
- Every changed or generated text file has been checked and ends with exactly one trailing newline and no extra blank lines at the bottom.
Copy file name to clipboardExpand all lines: .github/agents/reviewer.agent.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,7 @@ Review changes for correctness, maintainability, test coverage, workflow safety,
25
25
- Review changed `src/**/*.ps1` and `tests/**/*.ps1` against `.github/instructions/code-quality-matrix.instructions.md`; flag new or heavily changed code that exceeds the warning thresholds without a clear, explicit reason.
26
26
- Flag public files that do not keep exactly one top-level function, and flag private files that group multiple externally called functions instead of limiting extra functions to same-file support helpers. Also flag file/function name mismatches for public commands or externally called private helpers.
27
27
- Flag broad catch-all test files when focused source-mirrored tests would make ownership clearer.
28
+
- Flag Nova-managed validation that bypasses `Test-NovaBuild` with direct `Invoke-Pester`.
28
29
- Flag any PSScriptAnalyzer rule excludes or suppressions; the code should be fixed instead.
29
30
- Flag unresolved ScriptAnalyzer findings from `run.ps1` or `Invoke-ScriptAnalyzerCI.ps1`; they should be fixed instead of deferred.
Copy file name to clipboardExpand all lines: .github/agents/test-engineer.agent.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,20 +37,22 @@ Improve or maintain the repository's Pester coverage, coverage-gate behavior, an
37
37
38
38
## Constraints
39
39
40
-
- Prefer targeted tests first, then the full repo quality loop.
40
+
- Prefer the smallest `Test-NovaBuild` scope the project already supports, then the full repo quality loop.
41
41
- Keep test files maintainable; passing tests are not enough if Code Health degrades.
42
42
- Reuse existing fixture and support patterns before adding new ones.
43
43
- Do not group unrelated source files into one broad test file when mirrored `tests/public`, `tests/private`, or `tests/classes` ownership is possible.
44
44
- Do not introduce PowerShell 7.x-only test syntax or APIs into a project that targets `5.1` unless compatibility coverage is explicitly part of the scope.
45
45
- If CodeScene flags a regression, refactor the tests or helpers instead of suppressing the finding.
46
46
- Keep new or heavily changed tests inside the warning thresholds from `.github/instructions/code-quality-matrix.instructions.md` unless the scope explicitly justifies otherwise.
47
47
- Use `./scripts/build/Invoke-ScriptAnalyzerCI.ps1` as the normal analyzer entrypoint for changed test/helpers, and only fall back to direct `Invoke-ScriptAnalyzer` for focused local investigation with the repository-approved settings.
48
+
- Use `Test-NovaBuild` as the test entrypoint for Nova-managed projects; do not validate with direct `Invoke-Pester`.
48
49
49
50
## Definition of done
50
51
51
52
- The changed behavior is covered.
52
53
- Each new or changed `src/**/*.ps1` file has a matching source-mirrored test, or the cross-cutting owner test is named explicitly.
53
54
- The touched tests are readable and low-duplication.
55
+
- Validation uses `Test-NovaBuild` for project test execution.
54
56
- Validation and CodeScene implications are addressed.
55
57
- The pre-commit CodeScene safeguard is clean before the work is treated as commit-ready when local CodeScene tooling is available.
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,6 +47,7 @@ For new or not-yet-scoped work, start with `.github/agents/architect.agent.md` a
47
47
- Do not exclude or suppress PSScriptAnalyzer rules in repository analyzer helpers; fix the code that violates analyzer rules instead.
48
48
- Use `.github/instructions/psscriptanalyzer.instructions.md` as the ScriptAnalyzer workflow source of truth. Prefer `./scripts/build/Invoke-ScriptAnalyzerCI.ps1` and `./run.ps1`, and only use direct `Invoke-ScriptAnalyzer` for focused local checks or deliberate analyzer-tooling changes.
49
49
- Keep `run.ps1` as the local quality loop: run ScriptAnalyzer first, then `Invoke-NovaBuild`, then `Test-NovaBuild`.
50
+
- Use `Test-NovaBuild` as the authoritative test entrypoint in Nova-managed projects. Do not call `Invoke-Pester` directly, because it can bypass Nova's build/import/StrictMode flow and disagree with the result users get later.
50
51
- If `run.ps1` or `./scripts/build/Invoke-ScriptAnalyzerCI.ps1` reports ScriptAnalyzer findings, fix them before review, handoff, or commit. Do not treat a failing local quality loop as an acceptable stopping point.
51
52
- Keep file/function ownership explicit: `src/public/` files should own exactly one top-level function each, and `src/private/` files should expose at most one externally called function per file. Additional private functions may stay only as support helpers used from the same file, and the file name should match the function that owns the file.
52
53
- Use `.github/instructions/code-quality-matrix.instructions.md` as the best-effort quality matrix for `src/**/*.ps1` and `tests/**/*.ps1`; generated projects should follow that guidance through Agentic Copilot files, not by depending on a required `.codescene/code-health-rules.json`.
@@ -88,7 +89,7 @@ For new or not-yet-scoped work, start with `.github/agents/architect.agent.md` a
88
89
Use the smallest validation set that proves the change, then run the repository quality loop before finishing code work:
89
90
90
91
- local quality loop: `pwsh -NoLogo -NoProfile -File ./run.ps1`
Copy file name to clipboardExpand all lines: .github/instructions/testing-policy.instructions.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,8 @@ Use this file when changing production code, tests, coverage behavior, or CI tes
11
11
## Test expectations
12
12
13
13
- Behavior changes require Pester coverage.
14
-
- Prefer targeted tests close to the changed workflow area before running the full quality loop.
14
+
- Use `Test-NovaBuild` as the authoritative test entrypoint in Nova-managed projects. Do not validate with direct `Invoke-Pester`, because it can bypass Nova's build/import/StrictMode flow and disagree with what users see later.
15
+
- Prefer the smallest `Test-NovaBuild` scope the project already supports before running the full quality loop.
15
16
- Keep test names explicit about the behavior being proven.
16
17
- Reuse `*.TestSupport.ps1` helpers where possible.
17
18
- For every new or changed `src/**/*.ps1` file, add or update the matching source-mirrored `.Tests.ps1` file.
@@ -37,12 +38,13 @@ Use this file when changing production code, tests, coverage behavior, or CI tes
37
38
## Common pitfalls
38
39
39
40
- Many tests expect the built module under `dist/NovaModuleTools`; build first when needed.
41
+
- Direct `Invoke-Pester` runs can hide Nova-specific build/import/StrictMode behavior and should not be used as the project test entrypoint.
40
42
- Some support helpers must be dot-sourced and re-exported inside `BeforeAll`.
41
43
- Duplicated test setup can lower Code Health even when tests pass.
42
44
- Docs-only changes usually do not need executable validation, but workflow/test docs must still be kept accurate.
43
45
44
46
## Verification
45
47
46
-
-Targeted Pester file(s)
48
+
-`Test-NovaBuild`
47
49
-`./scripts/build/Invoke-ScriptAnalyzerCI.ps1` when PowerShell code changed
48
50
-`pwsh -NoLogo -NoProfile -File ./run.ps1` before completion
Copy file name to clipboardExpand all lines: .github/prompts/implement-issue.prompt.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,12 +24,13 @@ Implement the issue in the NovaModuleTools repository using the repository-local
24
24
12. Keep file/function ownership explicit: one externally called function per file, with private-file extras limited to same-file support helpers, and keep the file name aligned to the entry function.
25
25
13. Before handoff, review every changed or generated text file and normalize it to exactly one trailing newline with no extra blank lines at the bottom.
26
26
14. Add or update the matching source-mirrored Pester file for every changed `src/**/*.ps1` file; if the behavior is genuinely cross-cutting, document which integration/guardrail test owns it and why a mirrored unit test is not practical.
27
-
15. Add or update valid PlatyPS-compatible help under `docs/NovaModuleTools/en-US/` when public commands or public classes change. Use `New-MarkdownCommandHelp` for new help, `Update-MarkdownCommandHelp` after command-surface changes, and `Test-MarkdownCommandHelp` before handoff; do not replace command help with plain Markdown prose.
28
-
16. For every new public entry point, create its matching help file immediately in the same change.
29
-
17. Review `README.md`, `CONTRIBUTING.md`, `CHANGELOG.md`, `RELEASE_NOTE.md`, help docs, and `docs/*.html` as applicable.
30
-
18. If a commit message is requested, derive it from `$GIT_BRANCH_NAME` and the implemented change using the repository's Conventional Commit rules.
31
-
19. Run the relevant validation, then summarize what changed, why, and how it was verified.
32
-
20. If that summary is returned as Markdown or copy-ready UI output, format it according to the `markdown-authoring` skill (`.github/skills/markdown-authoring/SKILL.md`).
27
+
15. Validate Nova-managed project tests through `Test-NovaBuild`; do not call `Invoke-Pester` directly because it can bypass Nova's build/import/StrictMode flow.
28
+
16. Add or update valid PlatyPS-compatible help under `docs/NovaModuleTools/en-US/` when public commands or public classes change. Use `New-MarkdownCommandHelp` for new help, `Update-MarkdownCommandHelp` after command-surface changes, and `Test-MarkdownCommandHelp` before handoff; do not replace command help with plain Markdown prose.
29
+
17. For every new public entry point, create its matching help file immediately in the same change.
30
+
18. Review `README.md`, `CONTRIBUTING.md`, `CHANGELOG.md`, `RELEASE_NOTE.md`, help docs, and `docs/*.html` as applicable.
31
+
19. If a commit message is requested, derive it from `$GIT_BRANCH_NAME` and the implemented change using the repository's Conventional Commit rules.
32
+
20. Run the relevant validation, then summarize what changed, why, and how it was verified.
33
+
21. If that summary is returned as Markdown or copy-ready UI output, format it according to the `markdown-authoring` skill (`.github/skills/markdown-authoring/SKILL.md`).
Copy file name to clipboardExpand all lines: .github/prompts/improve-test-coverage.prompt.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,12 @@ Improve changed-code coverage in NovaModuleTools without lowering maintainabilit
12
12
6. Follow `.github/instructions/psscriptanalyzer.instructions.md` when test code or test helpers change. Prefer `./scripts/build/Invoke-ScriptAnalyzerCI.ps1` for repo-standard analyzer runs, and use direct `Invoke-ScriptAnalyzer` only for focused local checks that reuse the repo-approved settings.
13
13
7. Add the smallest test that proves the missing behavior.
14
14
8. If setup is duplicated, refactor the tests before adding more assertions.
15
-
9. Re-run the focused tests, then the repository quality loop if code changed.
15
+
9. Re-run `Test-NovaBuild`, then the repository quality loop if code changed. Do not validate a Nova-managed project with direct `Invoke-Pester`.
16
16
10. Recheck CodeScene coverage or Code Health if that was the original failure.
17
17
18
18
## Repository-specific reminders
19
19
20
20
- Many tests expect a built `dist/NovaModuleTools` module.
21
21
- The CI coverage flow writes `artifacts/pester-coverage.cobertura.xml`.
22
+
- Use `Test-NovaBuild` as the project test entrypoint; direct `Invoke-Pester` can miss Nova-specific strict-mode behavior.
22
23
- Do not "fix" coverage by weakening assertions or suppressing CodeScene warnings.
Copy file name to clipboardExpand all lines: .github/prompts/review-change.prompt.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Review a NovaModuleTools change set with emphasis on correctness, maintainabilit
9
9
3. Check changed `src/**/*.ps1` and `tests/**/*.ps1` against `.github/instructions/code-quality-matrix.instructions.md`.
10
10
4. Check changed PowerShell validation flow against `.github/instructions/psscriptanalyzer.instructions.md`; flag direct analyzer usage that bypasses the repository wrapper or repo-approved settings without a clear reason.
11
11
5. Check changed `docs/NovaModuleTools/en-US/*.md` against `.github/instructions/platyps-help.instructions.md` when command help was added or updated; flag files that do not follow the `New-MarkdownCommandHelp` / `Update-MarkdownCommandHelp` / `Test-MarkdownCommandHelp` workflow, miss a new public entry point's matching help file, or break the required PlatyPS section structure.
12
-
6. Check whether tests, docs, and changelog updates match the change.
12
+
6. Check whether tests, docs, and changelog updates match the change, and flag Nova-managed validation that bypasses `Test-NovaBuild` with direct `Invoke-Pester`.
13
13
7. Call out the smallest set of meaningful issues first.
14
14
8. Note any missing validation or follow-up work.
15
15
9. If the review is returned as Markdown or copy-ready UI text, format it according to the `markdown-authoring` skill (`.github/skills/markdown-authoring/SKILL.md`).
@@ -22,6 +22,7 @@ Use this skill when adding tests, closing coverage gaps, fixing regressions, or
22
22
- Match existing `Describe` / `It` naming style.
23
23
- Prefer support helpers for repeated setup.
24
24
- Build/import the dist module when the test file expects it.
25
+
- Use `Test-NovaBuild` as the authoritative test entrypoint in Nova-managed projects. Do not validate with direct `Invoke-Pester`, because it can miss the Nova build/import/StrictMode flow.
25
26
- Add coverage for both happy paths and explicit warnings/errors when behavior changed.
26
27
- For every new or changed `src/**/*.ps1` file, add or update one focused test file that mirrors the source path under `tests/`.
27
28
- Keep test files and helpers compatible with `project.json``Manifest.PowerShellHostVersion`; if a project targets `5.1`, do not introduce PowerShell 7.x-only syntax, cmdlets, parameters, or APIs in the tests.
@@ -34,13 +35,14 @@ Use this skill when adding tests, closing coverage gaps, fixing regressions, or
34
35
- Forgetting that many tests assume `dist/NovaModuleTools` already exists
35
36
- Duplicating setup instead of extending `*.TestSupport.ps1`
36
37
- Exporting helper functions at the wrong time in test lifecycle
38
+
- Validating a Nova-managed project with direct `Invoke-Pester` instead of `Test-NovaBuild`
37
39
- Passing tests while still degrading Code Health through duplication
38
40
- Grouping unrelated source files into one large test file when a source-mirrored layout would make ownership clearer
39
41
- Adding source files without a matching mirrored test or an explicit cross-cutting-test justification
40
42
- Ignoring the test-code matrix and letting new or heavily changed tests grow beyond the warning thresholds without justification
41
43
42
44
## Verification
43
45
44
-
- Run the touched test file(s) directly first
46
+
- Run `Test-NovaBuild`
45
47
- Run `./run.ps1` before finishing code changes
46
48
- If coverage is the goal, inspect `artifacts/pester-coverage.cobertura.xml` via the CI helper flow
0 commit comments