Skip to content

Harden PSDesiredStateConfiguration setup in Pester tests#296

Closed
Copilot wants to merge 4 commits into
mainfrom
copilot/update-isolation-aware-tests
Closed

Harden PSDesiredStateConfiguration setup in Pester tests#296
Copilot wants to merge 4 commits into
mainfrom
copilot/update-isolation-aware-tests

Conversation

Copilot AI commented Jun 23, 2026

Copy link
Copy Markdown

Several Pester suites handled PSDesiredStateConfiguration inconsistently: some always attempted installation, while others dereferenced .Version on a potentially missing module. This makes test bootstrap brittle in environments where the module is absent or repository access is unavailable.

  • Normalize module detection

    • Guard PSDesiredStateConfiguration installation behind an explicit availability check instead of assuming the module is already present.
  • Preserve version-specific behavior where required

    • Keep the existing 2.0.7 requirement in the suites that already depend on it, but check for that version safely before installing.
  • Remove unconditional installs

    • Update suites that previously installed PSDesiredStateConfiguration on every run to install only when the module is not already available.
  • Files updated

    • tests/GitDsc/GitDsc.tests.ps1
    • tests/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.Tests.ps1
    • tests/Microsoft.Windows.Developer/Microsoft.Windows.Developer.Tests.ps1
    • tests/Microsoft.VSCode.Dsc/Microsoft.VSCode.Dsc.Tests.ps1
if ($null -eq (Get-Module -Name PSDesiredStateConfiguration -ListAvailable | Where-Object Version -eq '2.0.7')) {
    Install-Module -Name PSDesiredStateConfiguration -Force -SkipPublisherCheck -RequiredVersion '2.0.7'
}

Copilot AI changed the title [WIP] Update PowerShell test suites to be isolation-aware Harden PSDesiredStateConfiguration setup in Pester tests Jun 23, 2026
@AmelBawa-msft AmelBawa-msft deleted the copilot/update-isolation-aware-tests branch June 23, 2026 16:00
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.

2 participants