I use Cypress with my local web app. I followed install and run instructions:


Tests work fine until I wanted to reset database state according to the instructions:


I always get same error:

TypeError: cy.resetDb is not a function

Any reccomendations how to fix that?

  • Do you actually have a resetDb command?
    – jonrsharpe
    Jul 8, 2019 at 11:21

1 Answer 1


You can use the beforeEach function to execute actions before every single test.

The Cypress documentation gives an example of how you can use beforeEach, but it expects you to implement the resetDb function. This is not a generic function supplied by Cypress.

Either remove the call to resetDb or implement it as a Cypress Custom Command.

  • Thank you for your answer. So, I assume there is no generic function to force use database in the same state at it used to be before star testing? Backend developer should prepare me one or there is any simpler solution for that?
    – Piecho3a
    Jul 8, 2019 at 10:54
  • @Piecho3a well how would Cypress know how to reset the database? It doesn't even know what DBMS you're using.
    – jonrsharpe
    Jul 8, 2019 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.