Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does this statement mean "Cypress commands do not return their subjects, they yield them"?

I'm learning about Cypress.io and came across this statement in their official site Cypress.io

"Cypress commands do not return their subjects, they yield them."

What is the difference between "yield" and "return" in commands in cypress.io?

like image 765
mjquito Avatar asked Oct 21 '25 05:10

mjquito


1 Answers

I take yield to mean 'pay it forward', whereas return = 'pay it back'.

See Core Concepts

Cypress commands are asynchronous and get queued for execution at a later time. During execution, subjects are yielded from one command to the next, and a lot of helpful Cypress code runs between each command to ensure everything is in order.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!