test: Add PSBuildTestFixture shared fixture module#135
Merged
Conversation
Add the minimal fixture module that the integration-test sub-tasks of #17 (#98-#103) build on, per the design recorded on #97: - tests/fixtures/PSBuildTestFixture/: valid manifest, dot-sourcing psm1, two public functions with complete comment-based help (no .LINK URLs, so no test makes a network call), one private helper, and an excludeme.txt for Build.Exclude assertions. Inert data only: no build files, no requirements manifest, no nested test suite. - tests/fixtures/FixtureHelpers.psm1: Copy-PSBuildTestFixture copies the fixture into a destination (typically $TestDrive) so consuming tests never mutate the checked-in fixture. - tests/Fixtures.tests.ps1: smoke tests covering the copy helper, manifest validity, import, exports, behavior, and help completeness. The repository Pester run collects only top-level tests/*.tests.ps1 files, so nothing under tests/fixtures/ can be discovered as a test. Closes #97 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011semwa5HU1BUKKL4RoWjKa
There was a problem hiding this comment.
Pull request overview
This PR adds a shared, inert PowerShell module fixture under tests/fixtures/PSBuildTestFixture/ plus a helper module and smoke tests, establishing a reusable baseline for upcoming integration-test work in #98–#103 (per #97’s agreed design).
Changes:
- Introduces the
PSBuildTestFixturemodule (manifest + module file + public/private function layout + exclude marker file). - Adds
Copy-PSBuildTestFixturehelper to copy the checked-in fixture into a test destination (typically$TestDrive). - Adds
tests/Fixtures.tests.ps1smoke tests validating copy behavior, manifest validity, module import/exports, function behavior, and help completeness.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/fixtures/PSBuildTestFixture/Public/Get-Widget.ps1 | Adds a public fixture function with comment-based help and typed parameters. |
| tests/fixtures/PSBuildTestFixture/Public/Set-Widget.ps1 | Adds a second public fixture function with SupportsShouldProcess. |
| tests/fixtures/PSBuildTestFixture/Private/Test-WidgetName.ps1 | Adds a private helper for export/compile assertions. |
| tests/fixtures/PSBuildTestFixture/PSBuildTestFixture.psm1 | Adds module entrypoint that dot-sources Public/Private and exports public functions. |
| tests/fixtures/PSBuildTestFixture/PSBuildTestFixture.psd1 | Adds the fixture module manifest (v0.1.0) defining exported functions and metadata. |
| tests/fixtures/PSBuildTestFixture/excludeme.txt | Adds an exclude marker file for build exclude-pattern assertions. |
| tests/fixtures/FixtureHelpers.psm1 | Adds Copy-PSBuildTestFixture helper module for copying the fixture into a destination. |
| tests/Fixtures.tests.ps1 | Adds smoke tests ensuring the fixture copies/imports correctly and exposes expected surface area. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Copy-PSBuildTestFixture now removes any existing copy and copies the fixture contents into a freshly created directory, so recopying into the same destination replaces the copy instead of nesting a second PSBuildTestFixture directory, and not-yet-created destinations work. Adds a regression test for the recopy case. - The fixture psm1 dot-sourcing error now includes the underlying exception message, not only the file path. - The help smoke test counts examples through an array subexpression: on Windows PowerShell 5.1 a single help example is a bare PSObject whose .Count is $null, which failed the CI 5.1 leg for Set-Widget. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011semwa5HU1BUKKL4RoWjKa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #97 per the design recorded on that issue — the shared fixture that the integration-test sub-tasks of #17 (#98–#103) build on:
tests/fixtures/PSBuildTestFixture/— a minimal, inert module fixture: valid manifest (0.1.0), dot-sourcing.psm1, two public functions (Get-Widget,Set-Widget) with complete comment-based help so the help-pipeline tests (Tests: Build-PSBuildMarkdown #99–Tests: Build-PSBuildUpdatableHelp #101) have real material, one private helper (Test-WidgetName) for export/compile assertions, and anexcludeme.txtforBuild.Excludeassertions. Deliberately no build files, norequirements.psd1, no nested test suite. No.LINKURLs anywhere, so no test ever makes a network call. Named distinctly from the existingtests/TestModule/to avoid module-name collisions in session state.tests/fixtures/FixtureHelpers.psm1—Copy-PSBuildTestFixturecopies the fixture into a destination (typically$TestDrive); consuming tests always operate on a copy, never the checked-in fixture.tests/Fixtures.tests.ps1— 9 smoke tests: copy helper behavior, manifest validity, import, exact exports (private helper not exported), end-to-end function behavior, and help completeness.Safety property: the repository's Pester run collects only top-level
tests/*.tests.ps1files (build.settings.ps1), so nothing undertests/fixtures/can ever be discovered as a test.Out of scope, per the issue: the existing
tests/TestModule/is untouched, and crash/failure fixtures for #102 will be generated into$TestDriveat runtime rather than checked in.Test Plan
Breaking Changes
None — test infrastructure only, nothing ships in the module.
🤖 Generated with Claude Code
https://claude.ai/code/session_011semwa5HU1BUKKL4RoWjKa
Generated by Claude Code