cypress-documentation
                                
                                 cypress-documentation copied to clipboard
                                
                                    cypress-documentation copied to clipboard
                            
                            
                            
                        Example of cy.then() returning synchronous values
Subject
then command
Description
https://docs.cypress.io/api/commands/then#The-number-subject-is-changed-by-returning
cy.wrap(1)
  .then((num) => {
    cy.wrap(num).should('equal', 1) // true
    return 2
  })
  .should('equal', 2) // true
When I try this I get the following error.
cy.then() failed because you are mixing up async and sync code.
Is this example still valid today?