Skip to content

Changes $configuration.Run.PassThru to $True#52

Merged
devblackops merged 1 commit into
psake:mainfrom
webtroter:patch-1
Aug 12, 2021
Merged

Changes $configuration.Run.PassThru to $True#52
devblackops merged 1 commit into
psake:mainfrom
webtroter:patch-1

Conversation

@webtroter

@webtroter webtroter commented Aug 11, 2021

Copy link
Copy Markdown
Contributor

Before Pester V5, the -PassThru parameter was used.

We could either use the -PassThru parameter, or set the run configuration in the Configuration Parameter.

Description

Currently, the Pester task never really fails, because Invoke-Pester doesn't PassThru

Related Issue

#51

Motivation and Context

Before the migration to PesterV5, the PassThru parameter was used, and the replacement in V5 was set to false in the PSBuild Task

How Has This Been Tested?

Changing it in my machine makes the task fail as it should.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Before Pester V5, the -PassThru parameter was used.

We could either use the -PassThru parameter, or set the run configuration in the Configuration Parameter.
@devblackops
devblackops self-requested a review August 12, 2021 05:06
@devblackops devblackops self-assigned this Aug 12, 2021
@devblackops devblackops added the bug Something isn't working label Aug 12, 2021
@devblackops
devblackops merged commit 9129ea6 into psake:main Aug 12, 2021
HeyItsGilbert added a commit that referenced this pull request Oct 6, 2024
### Changed

- Bump Pester to latest 5.6.1

### Fixed

- [**#52**](#52) Pester
object wasn't being passed back after running tests, causing the Pester
task to never fail (via [@webtroter](https://github.com/webtroter))
- [**#55**](#55) Add
`-Module` parameter to `Build-PSBuildUpdatableHelp` (via
[@IMJLA](https://github.com/IMJLA))
- [**#60**](#60) Fix
Windows PowerShell compatibility in `Initialize-PSBuild` (via
[@joshooaj](https://github.com/joshooaj))
- [**#62**](#62) Fix code
coverage output fle format not working (via
[@OpsM0nkey](https://github.com/OpsM0nkey))
tablackburn added a commit that referenced this pull request Jul 7, 2026
Test-PSBuildPester gated pass/fail only on FailedCount, so a
BeforeAll/AfterAll that threw or a test file that errored during
discovery left the count at zero and the build passed despite tests
never running. Gate on the run's aggregate Result property instead,
which Pester derives from all failure categories.

Also switch this repo's own psakeFile.ps1 Pester gate (the
three-counter sum from #128) to the same Result check so both gates
share one definition of "failed".

Companion to #128. Same bug lineage as #31, #52, and #57.
tablackburn pushed a commit that referenced this pull request Jul 10, 2026
Add tests/Test-PSBuildPester.tests.ps1 (#102).
Every invocation runs in a Start-Job subprocess with a pinned inner
Pester version, and the scenarios run against both installed Pester
majors (5.x and 6.x) to verify the shipped function keeps supporting
Pester 5 consumers. Crash fixtures are generated into $TestDrive at
runtime, never checked in. Scenarios: healthy suite, failing test
(regression #52), BeforeAll crash and discovery crash (#128/#133 gate),
NUnit result output, and code coverage output path/format (regression
Add a second, named Pester dependency (PesterLegacy, 5.9.0) to
requirements.psd1 so CI installs both majors side by side.

Fix two latent Test-PSBuildPester bugs the tests exposed, test-first
(all 14 tests failed before the fixes, pass after):

- The finally block called Remove-Module with an empty -Name when the
  optional ModuleName parameter was omitted, raising a parameter-
  binding error that -ErrorAction SilentlyContinue cannot suppress.
- An unconditional Import-Module Pester -MinimumVersion 5.0.0 loaded
  the newest installed Pester on top of an already-loaded one, which
  crashes with a Pester.dll version conflict when two versions are
  installed side by side. The function now respects a loaded Pester
  (with a clear error below 5.0.0) and imports the newest installed
  version only when none is loaded.

Closes #102

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011semwa5HU1BUKKL4RoWjKa
tablackburn added a commit that referenced this pull request Jul 10, 2026
)

Add tests/Test-PSBuildPester.tests.ps1 (#102). Every invocation runs
in a Start-Job subprocess with a pinned inner Pester version, and the
scenarios run against both installed Pester majors (5.x and 6.x) to
verify the shipped function keeps supporting Pester 5 consumers. Crash
fixtures are generated into $TestDrive at runtime, never checked in.
Scenarios: healthy suite, failing test (regression #52), BeforeAll
crash and discovery crash (#128/#133 gate), NUnit result output, and
code coverage output path/format (regression #62).

Pester 5.9.0 is installed side by side with 6.0.0 through the new
install-only requirements.pester-matrix.psd1; the bootstrap must not
import it, because importing two Pester majors into one session
crashes with a Pester.dll version conflict.

Fix two latent Test-PSBuildPester bugs the tests exposed, test-first:

- The finally block called Remove-Module with an empty -Name when the
  optional ModuleName parameter was omitted, raising a parameter-
  binding error that -ErrorAction SilentlyContinue cannot suppress.
- An unconditional Import-Module Pester -MinimumVersion 5.0.0 loaded
  the newest installed Pester on top of an already-loaded one. The
  function now respects a loaded Pester (with a clear error below
  5.0.0) and imports the newest installed version only when none is
  loaded.

Closes #102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants