See : https://github.com/cypress-io/cypress/issues/18915 An error 'Argument of type '() => void' is not assignable to parameter of type '() => Chainable<any>' throws when you return directly https://github.com/cypress-io/cypress/issues/18915#issuecomment-971834823 <img width="722" alt="Sans titre" src="https://user-images.githubusercontent.com/15921402/155544701-e7d312b2-d3af-489e-bc92-3559350f5ced.png">