Skip to content

Document soft assertions: explain -ErrorAction on generated Should-* pages + add a dedicated "Soft assertions" entry #385

Description

@nohwnd

Summary

Pester v6's "soft assertion" behaviour (collect all failures instead of stopping at the first one) is under-documented and hard to discover. The word "soft assertion" does not appear anywhere on https://pester.dev today — the feature is only described at the bottom of the Should page under the heading "Collect all Should failures".

This issue tracks two related documentation improvements.

1. Document -ErrorAction on the generated Should-* Command Reference pages

On every generated Should-* page (e.g. Should-Be), -ErrorAction currently only shows up in the generic boilerplate line:

This cmdlet supports the common parameters: -Debug, -ErrorAction, …

There is no hint that, for assertions, -ErrorAction is the knob that controls soft-assertion behaviour:

  • -ErrorAction Continue — record the failure but keep going (soft assertion)
  • -ErrorAction Stop — fail the test immediately (e.g. to guard a precondition before continuing)

We should surface this per-assertion meaning on the generated pages (e.g. via the comment-based help description/notes for the Should-* commands).

⚠️ Note: the Command Reference pages are auto-generated from comment-based help in the pester/pester source, so the actual text change for this part needs to land there. Filing here to track the overall documentation gap.

2. Add a dedicated "Soft assertions" entry describing how to enable them for every assertion

Add a discoverable entry (own section/page in the Assertions section) that:

  • Uses the term "soft assertions" explicitly so it's searchable.

  • Explains how to turn them on globally for every assertion, rather than per-assertion:

    $config = New-PesterConfiguration
    $config.Should.ErrorAction = 'Continue'
    # or via $PesterPreference.Should.ErrorAction = 'Continue'
  • Notes that the global setting is honoured by both the classic Should -Be syntax and the new Should-* assertions.

  • Shows how to override it on a single assertion with -ErrorAction Stop (precondition) / -ErrorAction Continue.

  • Cross-links from / consolidates the existing "Collect all Should failures" section.

Suggested section

Assertions

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions