Skip to content

[Bug]: Fix CI dependency installation warning #139

Description

@stiwicourage

Plan: Fix CI dependency installation warning

Problem statement

./scripts/build/ci/Install-CiPowerShellModules.ps1 installs NovaModuleTools from PSGallery with -AllowPrerelease, but the installation warns that Pester 5.7.1 is currently in use. The current behavior suggests CI is relying on manifest-driven dependency resolution during the parent module install instead of handling Pester explicitly. The fix should make dependency installation predictable, warning-free, and aligned with how the module actually uses Pester.

Evidence

  • scripts/build/ci/Install-CiPowerShellModules.ps1 only installs NovaModuleTools via Install-CiModule, using Install-Module -AllowPrerelease -Scope CurrentUser -Force, then reports the result with Get-InstalledModule.
  • project.json declares Manifest.RequiredModules for Pester 5.7.1 and Microsoft.PowerShell.PlatyPS 1.0.1.
  • src/private/build/BuildManifest.ps1 copies project.json manifest settings into the generated module manifest through Build-Manifest, and emits prerelease metadata from version 2.0.0-beta.
  • scripts/build/ci/Invoke-NovaModuleToolsCI.ps1 later imports both NovaModuleTools and Pester, confirming CI expects Pester separately at execution time.
  • src/private/quality/GetNovaTestWorkflowContext.ps1 uses New-PesterConfiguration, and the related Pester workflow depends on Pester being available when test commands run.
  • src/private/build/BuildHelp.ps1 handles Microsoft.PowerShell.PlatyPS as an on-demand dependency check, which is a useful contrast to the current manifest-driven Pester behavior.

Suspected root cause

Installing NovaModuleTools 2.0.0-beta from PSGallery also processes its published RequiredModules. Because Pester 5.7.1 is listed there, Install-Module tries to satisfy or update Pester during the parent install. If that exact dependency is already loaded or locked by the session or runner image, PowerShellGet emits the currently in use warning. The repo-controlled cause is that the installer hides dependency handling behind the module manifest instead of making Pester installation and usage explicit.

Files likely involved

  • scripts/build/ci/Install-CiPowerShellModules.ps1
  • project.json
  • src/private/build/BuildManifest.ps1
  • scripts/build/ci/Invoke-NovaModuleToolsCI.ps1
  • src/private/quality/GetNovaTestWorkflowContext.ps1
  • src/private/build/BuildHelp.ps1
  • tests/CoverageGaps.BuildInternals.Tests.ps1
  • tests/Module.Tests.ps1
  • .github/workflows/Tests.yml
  • .github/workflows/Publish.yml

Implementation steps

  1. Confirm the generated and published NovaModuleTools manifest still includes Pester 5.7.1 in RequiredModules, and verify that this dependency path is what Install-Module is resolving during CI install.
  2. Change the dependency strategy so Pester is handled explicitly instead of only through the published manifest, and prefer treating it as a test or runtime-on-demand dependency similar to how Build-Help checks for PlatyPS.
  3. Update project.json and the Build-Manifest inputs so the published manifest no longer forces unnecessary Pester installation during Install-Module NovaModuleTools, unless a strict runtime dependency is still required.
  4. Add an explicit availability check for Pester in the test workflow entrypoint so test commands fail with a clear message if Pester is not installed.
  5. Update scripts/build/ci/Install-CiPowerShellModules.ps1 to install direct CI dependencies intentionally, log what is being installed or skipped, and avoid hidden dependency churn during the NovaModuleTools install.
  6. Add regression coverage for both manifest generation and CI installer behavior so prerelease builds continue to publish the intended metadata without reintroducing the warning.

Validation steps

  • Run ./scripts/build/ci/Install-CiPowerShellModules.ps1 in a clean pwsh session and confirm the Pester 5.7.1 is currently in use warning no longer appears.
  • Inspect the built module manifest after Invoke-NovaBuild and confirm RequiredModules reflects the intended post-fix dependency model.
  • Run ./scripts/build/ci/Invoke-NovaModuleToolsCI.ps1 -OutputDirectory ./artifacts and confirm Import-Module NovaModuleTools and Import-Module Pester still succeed.
  • Run the affected Pester coverage around manifest generation and any new CI installer tests to confirm the dependency flow is stable for prerelease builds.

Risks

  • Removing Pester from RequiredModules may break Test-NovaBuild for users who relied on automatic dependency installation.
  • PowerShellGet and PSGallery behavior can vary by runner image, startup profile, or preloaded modules.
  • Changing manifest dependencies affects both CI install behavior and published consumer experience, so build and publish paths must stay aligned.

Success criteria

  • Installing NovaModuleTools 2.0.0-beta in CI no longer emits the Pester 5.7.1 is currently in use warning.
  • The dependency model is explicit: install-time behavior, manifest metadata, and test-time runtime checks all agree.
  • CI and publish workflows continue to build, import, and test NovaModuleTools successfully after the dependency handling change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions