Brandon
Brandon

Reputation: 504

Where to install Cypress when testing frontend/backend utilities and doing end-to-end tests?

I have a React project with a Node.js backend. Both parts are in seperate folders with separate package.json and node_modules.

The thing is that I want to do backend unit tests, frontend unit tests, and end-to-end tests.

I don't know if I should install Cypress twice on both the frontend and backend. Or there would be a way to only keep one Cypress installation.

Upvotes: 5

Views: 840

Answers (2)

Brandon
Brandon

Reputation: 504

One way to think about it would be to do it as if you were in a monorepo.

In a monorepo you might have multiple backend server and multiple frontend apps. Each of these will have their own unit tests in their own folder.

For end-to-end tests, we would put it inside each frontend apps. This is because different frontend apps do not interact with each other, but could call multiple different backend servers. By doing like this we group our test by website/apps.

Upvotes: 1

MkMan
MkMan

Reputation: 2191

Cypress runs in the browser and isn't used to test backends directly as far as I am aware.

I suggest placing it in the root of the repo as it tests both the frontend and backend projects.

Upvotes: 1

Related Questions