Skip to content

Say how the exit code behaves in the CI we actually build - #467

Open
nohwnd wants to merge 1 commit into
nohwnd-tutorial-refresh-outputfrom
nohwnd-tutorial-ci-exit-code
Open

Say how the exit code behaves in the CI we actually build#467
nohwnd wants to merge 1 commit into
nohwnd-tutorial-refresh-outputfrom
nohwnd-tutorial-ci-exit-code

Conversation

@nohwnd

@nohwnd nohwnd commented Aug 29, 2026

Copy link
Copy Markdown
Member

Fix #462

Stacked on #466. Review #464, #465, #466 first.

The exit code lesson did not survive into the workflow. tutorial/7-ci/1-test-script.mdx teaches that the exit code is the number of failures and proves it with pwsh -File, which is true. The GitHub Actions step on the very next page runs pwsh -command, and under -command PowerShell normalizes any non-zero exit to 1:

pwsh -NoProfile -File ./test.ps1              # 3 failures, exit code 3
pwsh -NoProfile -command ". './test.ps1'"     # 3 failures, exit code 1

The build still goes red, so nothing was broken, but the page sold a property that does not reach the CI it builds two pages later.

The coverage target is not a gate. Missing it changes nothing:

Covered 95% / 99%. 40 analyzed Commands in 7 Files.
Result: Passed   exit 0

"The target you are being measured against" reads like a gate to anybody wiring up a pipeline, so the page now says plainly that it is a number to compare against and points at the result object if you want to enforce it.

.gitignore is now actually created. Three pages said the artifacts belong in it, none created it, and the checklist then claimed both files were ignored. Following the tutorial literally committed testResults.xml and coverage.xml.

Annotations. Output.CIFormat defaults to Auto and detects $GITHUB_ACTIONS, so failures already show up on the job:

$ GITHUB_ACTIONS=true pwsh -NoProfile -File ./test.ps1
::error::[-] Returns all eight planets 26ms

That now comes before the dorny/test-reporter suggestion, which is still there for the case it genuinely helps with.

Culture. The cross platform note listed path separators and case sensitivity. The bug Planetarium actually has is culture: '{0,-8} {1} AU' -f ... formats with the current culture, so the report reads Mercury 0,387 AU on my machine. The suite stays green because the only asserted line is Earth 1 AU, which has no decimal part. It seemed worth saying that out loud on the page whose point is that a matrix finds the bugs you cannot see locally.

Verification

Measured all of it on pwsh 7.5.5 with Pester 6.1.0: exit codes for 0, 1 and 3 failures under both -File and -command, a run with CoveragePercentTarget = 99, a git init && git add . && git commit following the tutorial as written, and the annotation output with GITHUB_ACTIONS=true. Site builds.

🤖

The test script page teaches that the exit code is the number of failures and
proves it with pwsh -File. The GitHub Actions step on the next page runs
pwsh -command, which normalizes any non-zero exit to 1, so the count does not
survive into the pipeline the tutorial builds. The build still goes red, but we
were explaining it with the wrong mechanism.

Say that the coverage target is not a gate. Coming in under
CoveragePercentTarget does not fail the run and does not change the exit code,
and "the target you are being measured against" reads like a gate to anybody
setting up a pipeline.

Create the .gitignore. Three pages said the artifacts belong in it and none of
them created it, while the checklist claimed both files were ignored. Following
the tutorial literally committed testResults.xml and coverage.xml.

Mention that Pester already writes GitHub annotations through Output.CIFormat
before recommending an action that does something similar.

Add culture to the cross-platform note. It is the bug Planetarium actually has,
the report reads "Mercury  0,387 AU" on a machine with a comma decimal
separator, and the suite stays green because the only asserted line has no
decimal part.

Fix #462
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.

1 participant