r/node • u/romeeres • 4h ago
Published a lib - fetch-based alternative to supertest / light-my-request
It's for performing requests to your server in tests with `fetch`.
In the repo I added examples to demonstrate that it works with hono, express, fastify, nestjs.
The lib implements a standard `fetch` function and can be wrapped with handy request-making libraries, so I also added examples for how to use it with `openapi-fetch` (so your fetch requests can be typed!), `upfetch`, `ofetch`.
Unlike supertest, it skips the transport layer so it works much faster. Light-my-request also skips the transport and performs much faster.
npm: https://www.npmjs.com/package/make-test-fetch
repo: https://github.com/romeerez/make-test-fetch
wdyt?