Modernize release tests and remove dead publish tooling#2909
Merged
Conversation
nohwnd
force-pushed
the
nohwnd-update-release-tests
branch
from
July 19, 2026 07:37
fa90edc to
6172453
Compare
Fix pester#2877 The VersionChecks and StyleRules tests only ran through publish/testRelease.ps1, and nothing calls that script anymore. publish/release.ps1 runs test.ps1, testRelease.ps1 imported a publish/Pester.psd1 that does not exist, and the version check compared against a CHANGELOG.md we removed in 2020. - Delete publish/testRelease.ps1. - Rewrite the manifest checks with BeforeAll/BeforeDiscovery instead of the old $script: state, and drop the CHANGELOG.md checks. - Keep the release-only version and tag check, but guard it with -Skip unless HEAD is a tagged release commit. - Make release.ps1 fetch the tags and require HEAD to be on a release tag before running the tests. The publish pipeline can check out a shallow clone with no tags, and then the version check would silently skip and we would publish without it. Now it either runs or the release stops with a clear message. - Remove the trailing-whitespace/tab/newline style rules. I don't want a formatting gate in CI, and PSScriptAnalyzer already flags these on src/ in the code-analysis workflow. - Keep the module packaging check (issue pester#2826) and run it in test.ps1 instead of only through the dead release script. - Remove the PSv2 (PSVersion -ge 3) guard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
nohwnd
force-pushed
the
nohwnd-update-release-tests
branch
from
July 19, 2026 07:44
6172453 to
c01f303
Compare
Join-Path with three path arguments is PowerShell 7+ only. On 5.1 it throws "A positional parameter cannot be found that accepts argument '.git'" and fails discovery of the whole file. Nest the two calls instead, which works on both. 🤖
The version check compared the module version against a git tag on HEAD, and the release.ps1 guard required HEAD to be on a tag. But the tag is created when the draft GitHub release is published, after the automated release runs on CI, so at release time HEAD is not tagged. The guard would have blocked every release, and the check could never run. Remove both, and revert release.ps1. The manifest validity and module packaging checks stay and run in CI. release.ps1 already derives the version from the manifest, not a tag, so it needs no tag at all. 🤖
nohwnd
enabled auto-merge (squash)
July 19, 2026 08:37
buildNugetPackage.ps1 (which derived the version from a git tag), getNugetExe.ps1, and publish/vendor (a vendored nuget.exe and a psake packages.config) are all leftovers from the old build. Nothing calls them; build.ps1 and release.ps1 use dotnet and nuget from PATH. 🤖
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #2877
The
VersionChecksandStyleRulestests only ran throughpublish/testRelease.ps1, and nothing calls that script anymore.publish/release.ps1runstest.ps1,testRelease.ps1imported apublish/Pester.psd1that does not exist, and the version check compared against aCHANGELOG.mdwe removed back in 2020.Changes
publish/testRelease.ps1.tst/Pester.Tests.ps1withBeforeAllinstead of the old$script:state, and drop theCHANGELOG.mdchecks. They run in CI now (valid manifest, name, guid).src/in the code-analysis workflow, and I don't want a formatting gate in the test run.test.ps1instead of only through the dead release script.if ($PSVersionTable.PSVersion.Major -ge 3)PSv2 guard.buildNugetPackage.ps1(derived the version from a git tag),getNugetExe.ps1, andpublish/vendor(a vendorednuget.exeand a psakepackages.config). The currentbuild.ps1/release.ps1use dotnet andnugetfrom PATH.No release-time version gate. The tag is created when the draft release is published, after the automated release runs, so
HEADis not tagged whenrelease.ps1runs.release.ps1already derives the version from the manifest, not a tag, so it is unchanged.Verification
./test.ps1 -File tst/Pester.Tests.ps1 -NoBuild -SkipPTestson a clean build: 29 passed. Green on all CI legs including Windows PowerShell 5.1 on the prior push.Heads-up: #2875 also edits
tst/Pester.Tests.ps1(assertion migration), so one of the two will need a rebase.🤖