https://cypress.io logo
Hi all - is there a best practice when it comes to...
# best-practices
c
Hi all - is there a best practice when it comes to WHERE to put your cy.intercept commands? Let me explain. I found myself using some of the same intercepts/aliases over and over again, so to avoid repetition and keep things "neat", I have placed all of them in a beforeEach hook in e2e.ts, rather than putting them within each individual spec file. I got to thinking about this and was wondering if that would have any affect on performance (since it is loading all the intercepts before each test regardless of whether they are needed)? I was also wondering if it was better to have them in the individual tests just for readability sake (so you know what the alias refers to without having to go to another file), and just let there be some duplication. Thoughts?