Plan for 100% code coverage in selected files
Purpose
This plan describes a focused testing effort to raise code coverage to 100% in the files you identified.
The work should be:
- incremental
- reviewable
- driven by existing test suites where that makes sense
- focused on stable contracts rather than brittle implementation details
The goal is not just to “hit lines,” but to cover all relevant branches, error paths, and small helper functions in a way that keeps the codebase maintainable.
Primary goal
The following files are in scope for this plan and should end up at 100% coverage:
src/private/quality/WriteNovaPesterTestResultReport.ps1
src/private/release/ImportNovaPublishedLocalModule.ps1
src/private/package/GetNovaPackageMetadataList.ps1
src/private/package/MergeNovaPackageSettingTable.ps1
src/private/cli/GetNovaCliHelpRequest.ps1
src/private/package/GetNovaManifestValue.ps1
src/private/package/GetNovaPackageFileName.ps1
src/private/quality/WriteNovaPesterTestResultArtifact.ps1
src/private/package/GetNovaPackageSettingValue.ps1
src/private/package/GetNovaPackageUploadAuthHeaderValue.ps1
src/private/release/GetNovaLocalPublishActivation.ps1
src/private/update/GetNovaPrereleaseModuleUpdateConfirmationPrompt.ps1
src/private/package/GetNovaPackageArtifactPatternInfo.ps1
src/private/package/GetNovaPackageAuthorList.ps1
src/private/package/GetNovaPackageMetadata.ps1
src/private/package/GetNovaPackageOutputDirectory.ps1
src/private/package/GetNovaPackageUploadStatusCode.ps1
src/private/update/ConfirmNovaPrereleaseModuleUpdate.ps1
src/private/cli/AddNovaCliOptionValue.ps1
src/private/cli/ConfirmNovaCliAction.ps1
src/private/cli/FormatNovaCliCommandHelp.ps1
src/private/cli/GetNovaCliForwardingParameterSet.ps1
src/private/cli/GetNovaCliInstalledVersion.ps1
src/private/package/AssertNovaPackageMetadata.ps1
src/private/package/GetNovaPackageArtifactType.ps1
src/private/package/InitializeNovaPackageOutputDirectory.ps1
src/private/package/JoinNovaPackageUploadUrl.ps1
src/private/package/NewNovaPackageArtifacts.ps1
src/private/package/ResolveNovaPackageUploadTypeList.ps1
src/private/package/TestNovaPathContainsPath.ps1
src/private/quality/InitializeNovaPesterExecutionConfiguration.ps1
src/private/release/GetNovaInstalledProjectManifestPath.ps1
src/private/release/GetNovaPublishedLocalManifestPath.ps1
src/private/release/GetNovaResolvedPublishParameterMap.ps1
src/private/shared/GetNovaModulePsDataValue.ps1
src/private/shared/GetNovaProjectPackageOutputDirectorySettingsTable.ps1
src/private/shared/GetNovaResolvedProjectManifestSettings.ps1
src/private/update/InvokeNovaPowerShellScriptWithTimeout.ps1
src/public/InitializeNovaModule.ps1
Important working rules
- Preserve existing behavior unless a test reveals a real defect.
- Add tests in small batches of 3-6 files at a time.
- Prefer extending existing test files before creating new suites.
- Cover both happy paths and relevant edge/error paths.
- When a helper is already close to 100%, cover the last missing branch precisely instead of broadening the test unnecessarily.
- After each meaningful batch, relevant Code Health checks and safeguards must stay green.
Suggested test hosting
Use these existing test suites first:
-
tests/CoverageGaps.Cli.Tests.ps1
- CLI helpers
- update/confirm helpers with CLI-facing behavior
src/public/InitializeNovaModule.ps1
-
tests/CoverageGaps.ReleaseInternals.Tests.ps1
- release helpers
- local publish/import helpers
-
tests/RemainingHelperCoverage.Tests.ps1
- package helpers
- shared helpers
- small utility helpers
-
tests/UpdateNotification.Tests.ps1
- prerelease update confirmation helpers
-
tests/CiCoverage.Tests.ps1
- quality/Pester report helpers
Supplement with existing test-support files when small builders/stubs are needed:
tests/RemainingHelperCoverage.TestSupport.ps1
tests/UpdateNotification.TestSupport.ps1
tests/CoverageCompletion.TestSupport.ps1
tests/NovaCommandModel.PackageUpload.TestSupport.ps1
Prioritized execution plan
Phase 0 — Confirm the baseline and split the work
- Confirm that the user-provided file list is the current source of truth.
- Cross-check the list against
artifacts/coverage-low.txt after a fresh build/test run.
- Split the work into small, PR-friendly batches.
- Use this priority order:
- first files with 0-40% coverage
- then files with 40-85%
- finally files with 85%+ where only a single branch is still missing
Phase 1 — Close the 0% and low-coverage gaps first
These files should be tackled first because they provide the biggest coverage gain and often have only a few clear branches:
src/private/quality/WriteNovaPesterTestResultReport.ps1
src/private/update/GetNovaPrereleaseModuleUpdateConfirmationPrompt.ps1
src/private/update/ConfirmNovaPrereleaseModuleUpdate.ps1
src/private/release/ImportNovaPublishedLocalModule.ps1
src/private/quality/WriteNovaPesterTestResultArtifact.ps1
src/private/package/GetNovaManifestValue.ps1
src/private/release/GetNovaLocalPublishActivation.ps1
For each of these files, add tests that explicitly cover:
- normal return value
- missing input or empty values
- any error paths or delegation calls
- return-value structure or side effect, where relevant
Phase 2 — Finish the package metadata/settings/helpers area
Then take the package-related helpers in a grouped but still small and readable sequence of batches:
src/private/package/GetNovaPackageMetadataList.ps1
src/private/package/MergeNovaPackageSettingTable.ps1
src/private/package/GetNovaPackageSettingValue.ps1
src/private/package/GetNovaPackageMetadata.ps1
src/private/package/GetNovaPackageAuthorList.ps1
src/private/package/AssertNovaPackageMetadata.ps1
src/private/package/GetNovaPackageArtifactPatternInfo.ps1
src/private/package/GetNovaPackageArtifactType.ps1
src/private/package/GetNovaPackageOutputDirectory.ps1
src/private/package/GetNovaPackageFileName.ps1
src/private/package/GetNovaPackageUploadStatusCode.ps1
src/private/package/GetNovaPackageUploadAuthHeaderValue.ps1
src/private/package/InitializeNovaPackageOutputDirectory.ps1
src/private/package/JoinNovaPackageUploadUrl.ps1
src/private/package/NewNovaPackageArtifacts.ps1
src/private/package/ResolveNovaPackageUploadTypeList.ps1
src/private/package/TestNovaPathContainsPath.ps1
The tests should specifically ensure:
- empty and missing settings are handled correctly
- merge order and override rules are covered precisely
- metadata fields are returned correctly for both present and missing manifest fields
- URL/path helpers handle separators, empty segments, and simple edge cases
- artifact/type mapping and status codes have complete branch coverage
Phase 3 — Bring CLI helpers to 100%
Then focus on the CLI layer:
src/private/cli/GetNovaCliHelpRequest.ps1
src/private/cli/AddNovaCliOptionValue.ps1
src/private/cli/ConfirmNovaCliAction.ps1
src/private/cli/FormatNovaCliCommandHelp.ps1
src/private/cli/GetNovaCliForwardingParameterSet.ps1
src/private/cli/GetNovaCliInstalledVersion.ps1
Add or extend tests for:
- root help vs command help vs long/short help
- option-value parsing with valid and invalid argument combinations
- confirm behavior for accepted, rejected, and non-interactive/redirected scenarios
- help formatting with all relevant sections, docs links, and edge cases
- forwarding parameter sets with and without ShouldProcess-related parameters
- installed version with and without prerelease metadata
Phase 4 — Release/shared/public wrappers
Finish with the smaller wrappers and project/publish helpers:
src/private/release/GetNovaInstalledProjectManifestPath.ps1
src/private/release/GetNovaPublishedLocalManifestPath.ps1
src/private/release/GetNovaResolvedPublishParameterMap.ps1
src/private/shared/GetNovaModulePsDataValue.ps1
src/private/shared/GetNovaProjectPackageOutputDirectorySettingsTable.ps1
src/private/shared/GetNovaResolvedProjectManifestSettings.ps1
src/private/update/InvokeNovaPowerShellScriptWithTimeout.ps1
src/public/InitializeNovaModule.ps1
Here the tests should mainly protect:
- path construction
- fallback/default values
- delegation to underlying helpers/commands
- timeout/error behavior
- the public wrapper as a thin delegator with a stable contract
Concrete batch suggestions
Prefer to work in this order:
-
Batch A
WriteNovaPesterTestResultReport
WriteNovaPesterTestResultArtifact
InitializeNovaPesterExecutionConfiguration
-
Batch B
GetNovaPrereleaseModuleUpdateConfirmationPrompt
ConfirmNovaPrereleaseModuleUpdate
InvokeNovaPowerShellScriptWithTimeout
-
Batch C
ImportNovaPublishedLocalModule
GetNovaLocalPublishActivation
GetNovaInstalledProjectManifestPath
GetNovaPublishedLocalManifestPath
GetNovaResolvedPublishParameterMap
-
Batch D
- package metadata/settings helpers
-
Batch E
- package path/URL/output/artifact helpers
-
Batch F
-
Batch G
- shared helpers
src/public/InitializeNovaModule.ps1
Test strategy by helper type
Small pure functions
Use table-driven tests where appropriate to cover:
- null/empty input
- normal value
- fallback value
- invalid input
Delegators and wrappers
Use mocks and verify:
- the correct helper/command is called
- parameters are forwarded correctly
- the return value or error is translated stably
Formatters and report writers
Verify:
- content
- ordering
- absence/presence of sections
- encoding/output path where relevant
Interactive/timeout-based helpers
Isolate side effects behind mocks or controlled test seams and cover:
- success path
- negative path
- timeout/cancel path
Validation after each batch
Run at least the relevant focused tests plus the build:
pwsh -NoLogo -NoProfile -Command 'Set-Location "/Users/stiwi.courage/workspace/couragedk/NovaModuleTools"; Invoke-NovaBuild'
pwsh -NoLogo -NoProfile -Command 'Set-Location "/Users/stiwi.courage/workspace/couragedk/NovaModuleTools"; Invoke-Pester ./tests/CiCoverage.Tests.ps1 -Output Detailed'
pwsh -NoLogo -NoProfile -Command 'Set-Location "/Users/stiwi.courage/workspace/couragedk/NovaModuleTools"; Invoke-Pester ./tests/CoverageGaps.Cli.Tests.ps1 -Output Detailed'
pwsh -NoLogo -NoProfile -Command 'Set-Location "/Users/stiwi.courage/workspace/couragedk/NovaModuleTools"; Invoke-Pester ./tests/CoverageGaps.ReleaseInternals.Tests.ps1 -Output Detailed'
pwsh -NoLogo -NoProfile -Command 'Set-Location "/Users/stiwi.courage/workspace/couragedk/NovaModuleTools"; Invoke-Pester ./tests/RemainingHelperCoverage.Tests.ps1 -Output Detailed'
pwsh -NoLogo -NoProfile -Command 'Set-Location "/Users/stiwi.courage/workspace/couragedk/NovaModuleTools"; Invoke-Pester ./tests/UpdateNotification.Tests.ps1 -Output Detailed'
When a larger group is finished, also run the full quality flow:
zsh -lc 'pwsh -NoLogo -NoProfile -File "/Users/stiwi.courage/workspace/couragedk/NovaModuleTools/run.ps1" > /tmp/novamoduletools-run-coverage100.log 2>&1; rc=$?; tail -n 80 /tmp/novamoduletools-run-coverage100.log | cat; echo "EXIT:$rc"'
And always:
zsh -lc 'cd "/Users/stiwi.courage/workspace/couragedk/NovaModuleTools" && git --no-pager diff --check'
Code Health and safeguard requirements
After each meaningful batch:
- Run a Code Health review on the touched test files.
- Keep the target at
10.0, or refactor if the test code becomes too complex.
- Run the pre-commit Code Health safeguard before marking the work as done.
Documentation review
After each change, evaluate whether these need updates:
README.md
CONTRIBUTING.md
CHANGELOG.md
For this plan, documentation changes are normally not expected because the work is primarily about internal test coverage. If the test work reveals a real user-facing behavior change or a new contributor expectation, the documentation must be updated.
Definition of done
The work is only done when all of the following are true:
- All files in the scope list are at 100% code coverage.
- No public command contracts have changed unintentionally.
- Relevant test suites have been updated with stable, readable tests.
Invoke-NovaBuild passes.
- Relevant Pester suites pass.
run.ps1 passes.
git diff --check is clean.
- Code Health safeguards are green.
- The documentation review has been completed and its conclusion documented.
Progress tracking
Coverage batches
Validation checklist
Expected final report
When the work is complete, the final report should include at minimum:
- Which coverage gaps were closed
- Which files and test suites were updated
- How the tests were grouped and why
- Which edge/error paths gained coverage
- Validation commands and results
- Code Health results
- Documentation review and any updates
- Any remaining follow-up ideas
Plan for 100% code coverage in selected files
Purpose
This plan describes a focused testing effort to raise code coverage to 100% in the files you identified.
The work should be:
The goal is not just to “hit lines,” but to cover all relevant branches, error paths, and small helper functions in a way that keeps the codebase maintainable.
Primary goal
The following files are in scope for this plan and should end up at 100% coverage:
src/private/quality/WriteNovaPesterTestResultReport.ps1src/private/release/ImportNovaPublishedLocalModule.ps1src/private/package/GetNovaPackageMetadataList.ps1src/private/package/MergeNovaPackageSettingTable.ps1src/private/cli/GetNovaCliHelpRequest.ps1src/private/package/GetNovaManifestValue.ps1src/private/package/GetNovaPackageFileName.ps1src/private/quality/WriteNovaPesterTestResultArtifact.ps1src/private/package/GetNovaPackageSettingValue.ps1src/private/package/GetNovaPackageUploadAuthHeaderValue.ps1src/private/release/GetNovaLocalPublishActivation.ps1src/private/update/GetNovaPrereleaseModuleUpdateConfirmationPrompt.ps1src/private/package/GetNovaPackageArtifactPatternInfo.ps1src/private/package/GetNovaPackageAuthorList.ps1src/private/package/GetNovaPackageMetadata.ps1src/private/package/GetNovaPackageOutputDirectory.ps1src/private/package/GetNovaPackageUploadStatusCode.ps1src/private/update/ConfirmNovaPrereleaseModuleUpdate.ps1src/private/cli/AddNovaCliOptionValue.ps1src/private/cli/ConfirmNovaCliAction.ps1src/private/cli/FormatNovaCliCommandHelp.ps1src/private/cli/GetNovaCliForwardingParameterSet.ps1src/private/cli/GetNovaCliInstalledVersion.ps1src/private/package/AssertNovaPackageMetadata.ps1src/private/package/GetNovaPackageArtifactType.ps1src/private/package/InitializeNovaPackageOutputDirectory.ps1src/private/package/JoinNovaPackageUploadUrl.ps1src/private/package/NewNovaPackageArtifacts.ps1src/private/package/ResolveNovaPackageUploadTypeList.ps1src/private/package/TestNovaPathContainsPath.ps1src/private/quality/InitializeNovaPesterExecutionConfiguration.ps1src/private/release/GetNovaInstalledProjectManifestPath.ps1src/private/release/GetNovaPublishedLocalManifestPath.ps1src/private/release/GetNovaResolvedPublishParameterMap.ps1src/private/shared/GetNovaModulePsDataValue.ps1src/private/shared/GetNovaProjectPackageOutputDirectorySettingsTable.ps1src/private/shared/GetNovaResolvedProjectManifestSettings.ps1src/private/update/InvokeNovaPowerShellScriptWithTimeout.ps1src/public/InitializeNovaModule.ps1Important working rules
Suggested test hosting
Use these existing test suites first:
tests/CoverageGaps.Cli.Tests.ps1src/public/InitializeNovaModule.ps1tests/CoverageGaps.ReleaseInternals.Tests.ps1tests/RemainingHelperCoverage.Tests.ps1tests/UpdateNotification.Tests.ps1tests/CiCoverage.Tests.ps1Supplement with existing test-support files when small builders/stubs are needed:
tests/RemainingHelperCoverage.TestSupport.ps1tests/UpdateNotification.TestSupport.ps1tests/CoverageCompletion.TestSupport.ps1tests/NovaCommandModel.PackageUpload.TestSupport.ps1Prioritized execution plan
Phase 0 — Confirm the baseline and split the work
artifacts/coverage-low.txtafter a fresh build/test run.Phase 1 — Close the 0% and low-coverage gaps first
These files should be tackled first because they provide the biggest coverage gain and often have only a few clear branches:
src/private/quality/WriteNovaPesterTestResultReport.ps1src/private/update/GetNovaPrereleaseModuleUpdateConfirmationPrompt.ps1src/private/update/ConfirmNovaPrereleaseModuleUpdate.ps1src/private/release/ImportNovaPublishedLocalModule.ps1src/private/quality/WriteNovaPesterTestResultArtifact.ps1src/private/package/GetNovaManifestValue.ps1src/private/release/GetNovaLocalPublishActivation.ps1For each of these files, add tests that explicitly cover:
Phase 2 — Finish the package metadata/settings/helpers area
Then take the package-related helpers in a grouped but still small and readable sequence of batches:
src/private/package/GetNovaPackageMetadataList.ps1src/private/package/MergeNovaPackageSettingTable.ps1src/private/package/GetNovaPackageSettingValue.ps1src/private/package/GetNovaPackageMetadata.ps1src/private/package/GetNovaPackageAuthorList.ps1src/private/package/AssertNovaPackageMetadata.ps1src/private/package/GetNovaPackageArtifactPatternInfo.ps1src/private/package/GetNovaPackageArtifactType.ps1src/private/package/GetNovaPackageOutputDirectory.ps1src/private/package/GetNovaPackageFileName.ps1src/private/package/GetNovaPackageUploadStatusCode.ps1src/private/package/GetNovaPackageUploadAuthHeaderValue.ps1src/private/package/InitializeNovaPackageOutputDirectory.ps1src/private/package/JoinNovaPackageUploadUrl.ps1src/private/package/NewNovaPackageArtifacts.ps1src/private/package/ResolveNovaPackageUploadTypeList.ps1src/private/package/TestNovaPathContainsPath.ps1The tests should specifically ensure:
Phase 3 — Bring CLI helpers to 100%
Then focus on the CLI layer:
src/private/cli/GetNovaCliHelpRequest.ps1src/private/cli/AddNovaCliOptionValue.ps1src/private/cli/ConfirmNovaCliAction.ps1src/private/cli/FormatNovaCliCommandHelp.ps1src/private/cli/GetNovaCliForwardingParameterSet.ps1src/private/cli/GetNovaCliInstalledVersion.ps1Add or extend tests for:
Phase 4 — Release/shared/public wrappers
Finish with the smaller wrappers and project/publish helpers:
src/private/release/GetNovaInstalledProjectManifestPath.ps1src/private/release/GetNovaPublishedLocalManifestPath.ps1src/private/release/GetNovaResolvedPublishParameterMap.ps1src/private/shared/GetNovaModulePsDataValue.ps1src/private/shared/GetNovaProjectPackageOutputDirectorySettingsTable.ps1src/private/shared/GetNovaResolvedProjectManifestSettings.ps1src/private/update/InvokeNovaPowerShellScriptWithTimeout.ps1src/public/InitializeNovaModule.ps1Here the tests should mainly protect:
Concrete batch suggestions
Prefer to work in this order:
Batch A
WriteNovaPesterTestResultReportWriteNovaPesterTestResultArtifactInitializeNovaPesterExecutionConfigurationBatch B
GetNovaPrereleaseModuleUpdateConfirmationPromptConfirmNovaPrereleaseModuleUpdateInvokeNovaPowerShellScriptWithTimeoutBatch C
ImportNovaPublishedLocalModuleGetNovaLocalPublishActivationGetNovaInstalledProjectManifestPathGetNovaPublishedLocalManifestPathGetNovaResolvedPublishParameterMapBatch D
Batch E
Batch F
Batch G
src/public/InitializeNovaModule.ps1Test strategy by helper type
Small pure functions
Use table-driven tests where appropriate to cover:
Delegators and wrappers
Use mocks and verify:
Formatters and report writers
Verify:
Interactive/timeout-based helpers
Isolate side effects behind mocks or controlled test seams and cover:
Validation after each batch
Run at least the relevant focused tests plus the build:
When a larger group is finished, also run the full quality flow:
zsh -lc 'pwsh -NoLogo -NoProfile -File "/Users/stiwi.courage/workspace/couragedk/NovaModuleTools/run.ps1" > /tmp/novamoduletools-run-coverage100.log 2>&1; rc=$?; tail -n 80 /tmp/novamoduletools-run-coverage100.log | cat; echo "EXIT:$rc"'And always:
zsh -lc 'cd "/Users/stiwi.courage/workspace/couragedk/NovaModuleTools" && git --no-pager diff --check'Code Health and safeguard requirements
After each meaningful batch:
10.0, or refactor if the test code becomes too complex.Documentation review
After each change, evaluate whether these need updates:
README.mdCONTRIBUTING.mdCHANGELOG.mdFor this plan, documentation changes are normally not expected because the work is primarily about internal test coverage. If the test work reveals a real user-facing behavior change or a new contributor expectation, the documentation must be updated.
Definition of done
The work is only done when all of the following are true:
Invoke-NovaBuildpasses.run.ps1passes.git diff --checkis clean.Progress tracking
Coverage batches
Validation checklist
Invoke-NovaBuildpassesCiCoverage.Tests.ps1passesCoverageGaps.Cli.Tests.ps1passesCoverageGaps.ReleaseInternals.Tests.ps1passesRemainingHelperCoverage.Tests.ps1passesUpdateNotification.Tests.ps1passesrun.ps1passesgit diff --checkpassesExpected final report
When the work is complete, the final report should include at minimum: