NestJS 11 · Testing

Test over HTTP

Start the app in memory and call it with supertest.

const app = moduleRef.createNestApplication();
await app.init();
await request(app.getHttpServer()).get('/cats').expect(200);

Official NestJS 11 documentation

More testing commands

All testing commands · NestJS 11 cheatsheet

Was this page helpful?