Skip to content

docs: add dedicated "Soft assertions" page (#385)#397

Merged
nohwnd merged 1 commit into
mainfrom
nohwnd-soft-assertions-docs
Jul 3, 2026
Merged

docs: add dedicated "Soft assertions" page (#385)#397
nohwnd merged 1 commit into
mainfrom
nohwnd-soft-assertions-docs

Conversation

@nohwnd

@nohwnd nohwnd commented Jul 3, 2026

Copy link
Copy Markdown
Member

Summary

Addresses #385.

Pester v6's "soft assertion" behaviour (collect all failures instead of stopping at the first one) was under-documented and hard to discover — the word "soft assertion" did not appear anywhere on pester.dev, and the feature was only described at the bottom of the Should page under "Collect all Should failures".

This PR adds a dedicated, searchable page for it.

Changes

  • New page docs/assertions/soft-assertions.mdx that:
    • Uses the term "soft assertions" explicitly (so site search finds it) and defines it: collect all assertion failures in a test instead of stopping at the first.
    • Explains how to enable them globally for every assertion via Should.ErrorAction = 'Continue', using both New-PesterConfiguration and $PesterPreference.
    • States clearly that the global setting is honoured by both the classic Should -Be syntax and the new Should-* assertions, with a runnable example for each.
    • Shows how to override on a single assertion with -ErrorAction Stop (hard-fail a precondition before continuing) and -ErrorAction Continue (soft).
    • Cross-links to the Should page and the configuration reference.
  • docs/assertions/should-command.mdx: consolidated the existing "Collect all Should failures" section into a short soft-reference that links to the new page (no more duplicated example), with a reciprocal link.
  • sidebars.js: wired the new page into the Assertions section ordering.

The Should.ErrorAction property name, default ('Stop') and behaviour were verified against the Pester v6 source (src/csharp/Pester/ShouldConfiguration.cs).

yarn build passes with no broken-link warnings.

⚠️ Scope note — Part 1 not included

Issue #385 has two parts. This PR implements Part 2 only (the dedicated "Soft assertions" entry).

Part 1 — surfacing the per-assertion -ErrorAction meaning on the generated Should-* Command Reference pages (e.g. Should-Be) — requires a comment-based-help change in pester/pester, because those pages are auto-generated from source. It cannot be done in this docs repo and is not included here. That is why this PR says Addresses rather than Closes #385.

Add a discoverable docs/assertions/soft-assertions.mdx page that uses the
term "soft assertions" explicitly and explains how to collect all
assertion failures in a test by setting Should.ErrorAction = 'Continue'
globally. Documents that the setting is honoured by both the classic
Should -Be syntax and the new Should-* assertions, and how to override it
per assertion with -ErrorAction Stop/Continue.

Consolidate the existing "Collect all Should failures" section on the
Should page into a short soft-reference that links to the new page, and
wire the page into the Assertions sidebar.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nohwnd nohwnd merged commit bb0a681 into main Jul 3, 2026
4 checks passed
@nohwnd nohwnd deleted the nohwnd-soft-assertions-docs branch July 3, 2026 17:52
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