Skip to content

Conversation

@corbob
Copy link
Contributor

@corbob corbob commented Dec 11, 2025

PR Summary

Update build.ps1 to automatically "clean" when the bin directory is not present.

My testing process:

  1. Run git clean -xdf to restore the repository to a "clean" state.
  2. Run .\test.ps1 and ensure that it builds and passes the tests.

Fix #2670

PR Checklist

  • PR has meaningful title
  • Summary describes changes
  • PR is ready to be merged
    • If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
  • Tests are added/update (if required) Not required
  • Documentation is updated/added (if required) Not required

The build script previously did not build Pester the project unless
`-Clean` was specified. This meant that if you had not previously built
it with `-Clean`, then the generated files would be missing all of the
.Net assemblies, and the `PesterConfiguration.Formats.ps1xml` file, and
would prevent running of the `test.ps1` file. This adds a check at a
point in the build where we have either cleaned the bin directory
already, or it never existed. If it is not there then we clean so that
the build occurs.
@nohwnd
Copy link
Member

nohwnd commented Dec 12, 2025

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

build.ps1 Outdated
Remove-Item "$PSScriptRoot/bin" -Recurse -Force
}

if (-not (Test-Path "$PSScriptRoot/bin")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use elseif to avoid redundant call on clean build

@nohwnd
Copy link
Member

nohwnd commented Dec 15, 2025

The check is outdated, I've updated the pipeline. We need to explicitly name the steps in the branch check to avoid making it green and auto merge before azdo computes the steps to run.

@nohwnd nohwnd merged commit 86c333d into pester:main Dec 15, 2025
9 of 11 checks passed
@corbob corbob deleted the 2670-fix-build branch December 15, 2025 17:14
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.

build.ps1 and by extension test.ps1 doesn't build in a fresh repository

3 participants