Repository navigation
feat: add step.customMessage() to print a message above a failed step's error - #5819
Open
landon-medme wants to merge 2 commits into
Open
landon-medme wants to merge 2 commits into
landon-medme wants to merge 2 commits into
Conversation
…'s error
Pass step.customMessage('...') as a step's last argument, or chain
.customMessage('...') on the step. When the step fails, the message is
printed above the original error, which is indented under it. Steps that
never ran because an earlier step failed keep the original error.
landon-medme
marked this pull request as ready for review
November 26, 2026 13:55
mturner-med
approved these changes
Nov 26, 2026
This branch has not been deployed
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.
Motivation/Description of the PR
A failing step reports only the helper's own error, e.g.
element (#checkout) still not visible after 10 sec. That says what was missing but not what the test was trying to do. There was no way to attach a reason to a single step.step.customMessage()adds one. Pass it as the step's last argument, or chain it on the step like.timeout():When the step fails, the message is printed above the original error, which stays underneath, indented:
It's a separate
StepConfigfield (customMessage), not a key inopts, so it combines with.opts(),.timeout()and.retry()in any order. It works for any step, not only assertions.Assertion errors use the existing
params.customMessage. This also fixesAssertionFailedError.inspect()printingcustomMessagetwice when the template already includes{{customMessage}}, which all the built-in assertion templates do.When a step fails, the steps already queued after it also get
step.failedwith the same error. The message is only added to a step that actually started, so a later step's message never ends up on an earlier step's error.Applicable helpers:
The change is in the step recorder, so it applies to every helper.
Applicable plugins:
Type of change
Checklist:
npm run docs)npm run lint)npm test)