Description
What would you like?
As discussed and revealed in cypress-io/cypress-documentation#5054 (comment), .isChildCommand()
is basically a mistake; it should be removed and replaced with more specific errors in the two places we've used it.
Why is this needed?
I created isChildCommand()
based on our docs ("must be chained off cy" / "must not be chained off cy"). But the more I work with our command interface, the more I realize it just doesn't make sense: all uses of ensure.isChildCommand
would be better served by a more specific error in the individual command.
We currently use it in two places:
.within()
, which should actually be asserting that the subject is an element or document (.isType()
)..as()
, which should actually be asserting that the subject is not null (or that it's after.intercept()
).
In #25738 (comment), I added it to .should()
- but this is a breaking change, and we've decided to walk it back.
Basically, a generic "this must be a child command" is never the correct error to throw; we want to point users more usefully to what a specific command requires as a subject.
Other
No response