docs: add dedicated "Soft assertions" page (#385)#397
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
docs/assertions/soft-assertions.mdxthat:Should.ErrorAction = 'Continue', using bothNew-PesterConfigurationand$PesterPreference.Should -Besyntax and the newShould-*assertions, with a runnable example for each.-ErrorAction Stop(hard-fail a precondition before continuing) and-ErrorAction Continue(soft).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.ErrorActionproperty name, default ('Stop') and behaviour were verified against the Pester v6 source (src/csharp/Pester/ShouldConfiguration.cs).yarn buildpasses with no broken-link warnings.Issue #385 has two parts. This PR implements Part 2 only (the dedicated "Soft assertions" entry).
Part 1 — surfacing the per-assertion
-ErrorActionmeaning on the generatedShould-*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.