Hi there first time usi…

1 minute read

Hi there, first time using nx. Was wondering what the correct way to add some API integration/end-to-end tests would be? The documentation only talks about Cypress testing but I’m more interesting in creating some backend specific tests with a tool like supertest to fully test the API endpoints but without going through a front-end app

Responses:

There might be a framework out there. But i think most people use jest or mocha or something similar for the back-end. Supertest is awesome. It has a lot of cool http features. But I personally used sinonjs for almost every call. I did write a lot of tests that hit real servers, but there were difficult to maintain, unless you set them up. Meaning, you Actually write code before and after the test to make sure it passes everytime. E.g testing getting an user info, you would have to execute a code to insert an user, get the info and make the assertions you need to make, and then probably delete the user or do nothing. But then who tests your test?

You could write your own builder that runs supertest or use the run-commands builder to run any terminal command you want

Updated: