Skip to content

test: Add PSBuildTestFixture shared fixture module#135

Merged
tablackburn merged 2 commits into
mainfrom
claude/psake-project-next-item-6mfurr
Jul 9, 2026
Merged

test: Add PSBuildTestFixture shared fixture module#135
tablackburn merged 2 commits into
mainfrom
claude/psake-project-next-item-6mfurr

Conversation

@tablackburn

Copy link
Copy Markdown
Contributor

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 #99Tests: Build-PSBuildUpdatableHelp #101) have real material, one private helper (Test-WidgetName) for export/compile assertions, and an excludeme.txt for Build.Exclude assertions. Deliberately no build files, no requirements.psd1, no nested test suite. No .LINK URLs anywhere, so no test ever makes a network call. Named distinctly from the existing tests/TestModule/ to avoid module-name collisions in session state.
  • tests/fixtures/FixtureHelpers.psm1Copy-PSBuildTestFixture copies 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.ps1 files (build.settings.ps1), so nothing under tests/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 $TestDrive at runtime rather than checked in.

Test Plan

  • Full suite green locally under Pester 6.0.0: 376 passed, 0 failed, 15 skipped (376 = prior 367 + 9 new smoke tests)
  • CI matrix green (ubuntu / windows pwsh / windows PowerShell 5.1 / macOS)

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

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

Copilot AI left a comment

Copy link
Copy Markdown

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 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 PSBuildTestFixture module (manifest + module file + public/private function layout + exclude marker file).
  • Adds Copy-PSBuildTestFixture helper to copy the checked-in fixture into a test destination (typically $TestDrive).
  • Adds tests/Fixtures.tests.ps1 smoke 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.

Comment thread tests/fixtures/FixtureHelpers.psm1
Comment thread tests/fixtures/PSBuildTestFixture/PSBuildTestFixture.psm1
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Test Results

    4 files  ± 0    652 suites  +12   24s ⏱️ +2s
  391 tests + 9    389 ✅ + 9   2 💤 ±0  0 ❌ ±0 
1 568 runs  +40  1 521 ✅ +40  47 💤 ±0  0 ❌ ±0 

Results for commit 9166a16. ± Comparison against base commit 57d7953.

♻️ This comment has been updated with latest results.

- 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
@tablackburn tablackburn merged commit 82532a3 into main Jul 9, 2026
9 checks passed
@tablackburn tablackburn deleted the claude/psake-project-next-item-6mfurr branch July 9, 2026 23:23
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.

3 participants