Skip to content

Commit 6102679

Browse files
committed
fix: restore nested private helper coverage
- expand Pester CodeCoverage paths so nested src/private folders are included in artifacts/coverage.xml - stop build test support files from shadowing manifest helper coverage - add mirrored duplicate-validation tests for quality/duplicates helpers
1 parent b178353 commit 6102679

13 files changed

Lines changed: 134 additions & 11 deletions

.github/instructions/testing-policy.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ NovaModuleTools is migrating tests to a 1:1 source-to-test layout per issue #208
1616
- Tests do **not** `Import-Module $project.OutputModuleDir`.
1717
- Tests do **not** use `InModuleScope <ModuleName> { ... }`. Mocked functions live in the same scope as the test because they were dot-sourced into it.
1818
- Shared fixtures and dot-source helpers live in `tests/TestHelpers/`.
19-
- This makes `project.json` `Pester.CodeCoverage.Path = ["src/public/*.ps1", "src/private/**/*.ps1"]` produce real source-file coverage and means `Test-NovaBuild` does not require a `dist/` folder.
19+
- This makes `project.json` `Pester.CodeCoverage.Path = ["src/public/*.ps1", "src/private/*.ps1", "src/private/*/*.ps1", "src/private/*/*/*.ps1"]` produce real source-file coverage, including nested helper folders such as `src/private/build/manifest/` and `src/private/quality/duplicates/`, and means `Test-NovaBuild` does not require a `dist/` folder.
2020

2121
Example:
2222

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5656
- Code coverage in `Test-NovaBuild` now runs against the source files, instead of the built `dist/<ModuleName>/<ModuleName>.psm1` file so measured coverage percentages and line numbers align with the deployed module.
5757
- `Invoke-CodeSceneAnalysis.ps1` now normalizes Pester's JaCoCo output before upload so the `<class sourcefilename>` and `<sourcefile name>` entries are bare filenames and `package + sourcefile` resolves to real repository paths. This fixes the CodeScene `cs-coverage upload` failure "The coverage data does not contains any records related to the current repo" that appeared after the source-mirrored coverage migration.
5858
- `Invoke-CodeSceneAnalysis.ps1` now only invokes the `cs-coverage upload … --metric branch-coverage` step when the JaCoCo report actually contains `<counter type="BRANCH">` entries, so Pester reports that only emit line counters no longer fail the CodeScene step with "Requested metric is not present in coverage data".
59+
- Pester coverage configuration now uses explicit private-folder depth globs instead of `src/private/**/*.ps1`, so nested helpers such as `src/private/build/manifest/` and `src/private/quality/duplicates/` are included in `artifacts/coverage.xml` during the full `Test-NovaBuild` run.
5960

6061

6162
### Security

RELEASE_NOTE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Release notes
22

3-
This file summarizes public cmdlet, CLI, configuration, and migration changes for NovaModuleTools.
4-
`CHANGELOG.md` remains the exhaustive record of all changes in each release. **UNRELEASED** changes will be included in the next **stable** release!
3+
This file summarizes the release notes for NovaModuleTools. **UNRELEASED** changes will be included in the next **stable** release!
54

65
## [Unreleased]
76
### Added

project.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
"Enabled": true,
4545
"Path": [
4646
"src/public/*.ps1",
47-
"src/private/**/*.ps1"
47+
"src/private/*.ps1",
48+
"src/private/*/*.ps1",
49+
"src/private/*/*/*.ps1"
4850
],
4951
"CoveragePercentTarget": 99,
5052
"OutputPath": "artifacts/coverage.xml",

src/resources/ProjectTemplate.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
"Enabled": false,
2828
"Path": [
2929
"src/public/*.ps1",
30-
"src/private/**/*.ps1",
30+
"src/private/*.ps1",
31+
"src/private/*/*.ps1",
32+
"src/private/*/*/*.ps1",
3133
"src/classes/*.ps1"
3234
],
3335
"CoveragePercentTarget": 90,

src/resources/agentic-copilot/.github/instructions/testing-policy.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Use this file when changing production code, tests, coverage behavior, or CI tes
1616
- Tests do **not** `Import-Module $project.OutputModuleDir`.
1717
- Tests do **not** use `InModuleScope <ModuleName> { ... }`. Mocked functions live in the same scope as the test because they were dot-sourced into it.
1818
- Shared fixtures and dot-source helpers live in `tests/TestHelpers/`.
19-
- This makes `project.json` `Pester.CodeCoverage.Path = ["src/public/*.ps1", "src/private/**/*.ps1"]` produce real source-file coverage and means `Test-NovaBuild` does not require a `dist/` folder.
19+
- This makes `project.json` `Pester.CodeCoverage.Path = ["src/public/*.ps1", "src/private/*.ps1", "src/private/*/*.ps1", "src/private/*/*/*.ps1"]` produce real source-file coverage, including nested helper folders such as `src/private/build/manifest/` and `src/private/quality/duplicates/`, and means `Test-NovaBuild` does not require a `dist/` folder.
2020

2121
Example:
2222

src/resources/example/project.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@
8686
"Enabled": false,
8787
"Path": [
8888
"src/public/*.ps1",
89-
"src/private/**/*.ps1",
89+
"src/private/*.ps1",
90+
"src/private/*/*.ps1",
91+
"src/private/*/*/*.ps1",
9092
"src/classes/*.ps1"
9193
],
9294
"CoveragePercentTarget": 90,

tests/private/build/AssertNovaPublicFunctionFileLayout.TestSupport.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ function Stop-NovaOperation {
44
$record = [System.Management.Automation.ErrorRecord]::new($exception, $ErrorId, $Category, $TargetObject)
55
throw $record
66
}
7-
function Get-FunctionNameFromFile {param($filePath)}

tests/private/build/AssertNovaPublicFunctionFileLayout.Tests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
BeforeAll {
22
$projectRoot = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))
33
. (Join-Path $projectRoot 'src/private/build/AssertNovaPublicFunctionFileLayout.ps1')
4+
. (Join-Path $projectRoot 'src/private/build/manifest/GetFunctionNameFromFile.ps1')
45

56
. (Join-Path $PSScriptRoot 'AssertNovaPublicFunctionFileLayout.TestSupport.ps1')
67
}

tests/private/build/BuildManifest.TestSupport.ps1

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@ function Stop-NovaOperation {
55
throw $record
66
}
77
function Get-NovaBuildProjectInfo {param($ProjectInfo); return $ProjectInfo}
8-
function Get-FunctionNameFromFile {param($filePath); return @('Foo')}
9-
function Get-AliasInFunctionFromFile {param($filePath); return @()}
10-
function Assert-ManifestSchema {param($Manifest, $AllowedParameter)}

0 commit comments

Comments
 (0)