Skip to content

test: add coverage for Build-PSBuildModule#115

Open
nthbotast wants to merge 3 commits intopsake:mainfrom
nthbotast:chore/tests-build-psbuildmodule-98
Open

test: add coverage for Build-PSBuildModule#115
nthbotast wants to merge 3 commits intopsake:mainfrom
nthbotast:chore/tests-build-psbuildmodule-98

Conversation

@nthbotast
Copy link

Summary

  • add a new Pester test file for Build-PSBuildModule
  • cover README -> about_<Module>.help.txt copy behavior in culture folder
  • cover manifest FunctionsToExport update from Public/*.ps1 basenames

Validation

  • git diff --cached --check
  • pwsh runtime is not available in this execution environment (command not found), so Pester execution could not be run locally

Fixes #98

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds three new Pester 5 unit test files for public functions in the PowerShellBuild module: Build-PSBuildModule, Build-PSBuildUpdatableHelp, and Build-PSBuildMarkdown. The tests dot-source the individual function files and use Pester mocks to verify behavior in isolation, complementing the existing integration tests in build.tests.ps1.

Changes:

  • Added Build-PSBuildModule.tests.ps1 covering README → about-help file copy and manifest FunctionsToExport update scenarios
  • Added Build-PSBuildUpdatableHelp.tests.ps1 covering non-Windows early exit, output folder creation with cab generation, and cleanup of existing output
  • Added Build-PSBuildMarkdown.tests.ps1 covering no-commands warning, markdown generation without overwrite, and markdown update with overwrite/force

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/Build-PSBuildModule.tests.ps1 New unit tests for Build-PSBuildModule covering README copy to culture folder and public function export in manifest
tests/Build-PSBuildUpdatableHelp.tests.ps1 New unit tests for Build-PSBuildUpdatableHelp covering non-Windows guard, cab generation per locale, and output folder cleanup
tests/Build-PSBuildMarkdown.tests.ps1 New unit tests for Build-PSBuildMarkdown covering empty export warning, non-overwrite generation, and overwrite/force generation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,87 @@
Describe 'Build-PSBuildUpdatableHelp' {
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR title and description say this adds coverage for Build-PSBuildModule, but the PR also includes new test files for Build-PSBuildUpdatableHelp and Build-PSBuildMarkdown which are not mentioned in the title, description, or the linked issue #98. The description's "Summary" section should be updated to reflect all three test files being added, or the extra test files should be split into separate PRs aligned with their own issues.

Copilot uses AI. Check for mistakes.
-Culture 'en-US'

Should -Invoke New-Item -Times 1 -ParameterFilter { $Path -eq '/tmp/out' -and $ItemType -eq 'Directory' }
Should -Invoke New-Item -Times 1 -ParameterFilter { $Path -eq '/tmp/out/en-US' -and $Type -eq 'Directory' -and $Force }
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the ParameterFilter, $Type is used but -Type is an alias for -ItemType on New-Item. Pester parameter filters expose parameters by their canonical name, not aliases. Since the source code at Build-PSBuildModule.ps1:117 calls New-Item $culturePath -Type Directory -Force, PowerShell binds -Type to -ItemType. The filter should use $ItemType -eq 'Directory' instead of $Type -eq 'Directory', otherwise this assertion will not match correctly.

Suggested change
Should -Invoke New-Item -Times 1 -ParameterFilter { $Path -eq '/tmp/out/en-US' -and $Type -eq 'Directory' -and $Force }
Should -Invoke New-Item -Times 1 -ParameterFilter { $Path -eq '/tmp/out/en-US' -and $ItemType -eq 'Directory' -and $Force }

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests: Build-PSBuildModule

2 participants