Skip to content

refactor(tests): 🔧 Update test setup to use build script#171

Merged
HeyItsGilbert merged 1 commit into
masterfrom
BuildBeforeTest
May 15, 2026
Merged

refactor(tests): 🔧 Update test setup to use build script#171
HeyItsGilbert merged 1 commit into
masterfrom
BuildBeforeTest

Conversation

@HeyItsGilbert
Copy link
Copy Markdown
Member

@HeyItsGilbert HeyItsGilbert commented May 15, 2026

  • Replaced Set-BuildEnvironment with a call to the build script in multiple test files.
  • This change standardizes the test environment setup across all test cases.
  • Allows easier testing with the Testing VS Code tool.

What this changes

Ensures that a build is run before a Pester test run. This help when invoking directly with Pester or via the VS Code Test tool.

Why

Closes #

Type of change

  • Bug fix (non-breaking change that corrects incorrect behavior)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Chore / refactor / documentation (no behavior change)

Checklist

  • Pester tests added or updated to cover the change
  • Invoke-psake Analyze passes locally with no new warnings
  • Invoke-psake Test passes locally on at least one platform
  • CHANGELOG.md updated (required for any user-facing change)
  • Documentation updated if behavior changed

Additional notes

Copilot AI review requested due to automatic review settings May 15, 2026 22:47
* Replaced `Set-BuildEnvironment` with a call to the build script in multiple test files.
* This change standardizes the test environment setup across all test cases.
* Allows easier testing with the Testing VS Code tool.
Copy link
Copy Markdown
Contributor

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

Replaces Set-BuildEnvironment -Path "$PSScriptRoot/.." -Force with a direct call to build.ps1 -Task 'Build' in the BeforeAll block of 14 type-specific Pester test files, intended to standardize bootstrapping across tests and make the VS Code Testing tool able to run them.

Changes:

  • Swaps Set-BuildEnvironment for & "$PSScriptRoot\..\build.ps1" -Task 'Build' in 14 Tests/*.Type.Tests.ps1 files.
  • Keeps the if (-not $env:BHProjectPath) guard so the setup runs only when env vars aren't already populated.
  • Does not touch Tests/PSDepend.Tests.ps1, Tests/Help.tests.ps1, or Tests/PSModuleGallery.Type.Tests.ps1, which use a different setup pattern.

Reviewed changes

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

Show a summary per file
File Description
Tests/Chocolatey.Type.Tests.ps1 Switch to invoking build.ps1 -Task Build
Tests/Command.Type.Tests.ps1 Same setup change
Tests/DotnetSdk.Type.Tests.ps1 Same setup change
Tests/FileDownload.Type.Tests.ps1 Same setup change
Tests/FileSystem.Type.Tests.ps1 Same setup change
Tests/Git.Type.Tests.ps1 Same setup change
Tests/GitHub.Type.Tests.ps1 Same setup change
Tests/Noop.Type.Tests.ps1 Same setup change
Tests/Npm.Type.Tests.ps1 Same setup change
Tests/Nuget.Type.Tests.ps1 Same setup change
Tests/Package.Type.Tests.ps1 Same setup change
Tests/PSGalleryModule.Type.Tests.ps1 Same setup change
Tests/PSGalleryNuget.Type.Tests.ps1 Same setup change
Tests/Task.Type.Tests.ps1 Same setup change

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

BeforeAll {
if (-not $env:BHProjectPath) {
Set-BuildEnvironment -Path "$PSScriptRoot/.." -Force
& "$PSScriptRoot\..\build.ps1" -Task 'Build'
Comment on lines 9 to +10
if (-not $env:BHProjectPath) {
Set-BuildEnvironment -Path "$PSScriptRoot/.." -Force
& "$PSScriptRoot\..\build.ps1" -Task 'Build'
@HeyItsGilbert HeyItsGilbert merged commit 73b06ec into master May 15, 2026
3 of 4 checks passed
@HeyItsGilbert HeyItsGilbert deleted the BuildBeforeTest branch May 15, 2026 22:51
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