Skip to content

Conversation

@corbob
Copy link
Contributor

@corbob corbob commented Dec 11, 2025

Description

Pester always sets $LASTEXITCODE, so there is no need to manually set it to the number of failed tests. Further, in the event of a container failure, the number of failed tests could be 0 when the failure occurs before enumeration of the tests.

Additionally, this exit code doesn't actually help as test-kitchen does
not display the exit code, and itself exits with 20.

I have not added any tests for this, as I'm not entirely sure the best way to add a test for this. The testing steps that I took:

  1. Clone https://github.com/corbob/testkitchen-repros and switch to that directory.
  2. Run kitchen test and verify that with kitchen-pester version 1.2.0 installed the test completes successfully.
  3. Install this PR's changes.
  4. Run kitchen test and verify that with this version installed the tests fail and exit with code 20.

Issues Resolved

Type of Change

Note

I have not followed Conventional Commit messages here. I have followed the messages we use at Chocolatey. I am more than happy to fix the commits up prior to merge to follow the Conventional Commit messages format.

As for the question about type of change: I am split between this being a _fix _, and a _fix!_... On the one hand, this is fixing an issue in that a failure of Pester will actually result in failed tests. On the other hand, this is changing the behavior, and thus might be considered breaking?

Our release process assumes you are using Conventional Commit messages.

The most important prefixes you should have in mind are:

  • _fix_: which represents bug fixes, and correlates to a SemVer patch.
  • _feat_: which represents a new feature, and correlates to a SemVer minor.
  • _feat!_:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a major version change.

If you have not included a conventional commit message this can be fixed on merge.

Check List

Pester always sets `$LASTEXITCODE`, so there is no need to manually set
it to the number of failed tests. Further, in the event of a container
failure, the number of failed tests could be 0 when the failure occurs
before enumeration of the tests.

Additionally, this exit code doesn't actually help as test-kitchen does
not display the exit code, and itself exits with 20.
@corbob
Copy link
Contributor Author

corbob commented Dec 11, 2025

I'm not sure that the check failures are related to my changes as they also failed on #106...

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.

kitchen-pester reports success when containers fail

1 participant