End-to-end Tests — Testing · NestJS

Boot the real application inside a test and send it HTTP requests with supertest, asserting status codes, bodies and validation, the things a unit test cannot see.

What you will learn

Read the theory for End-to-end Tests

All Testing lessons

All NestJS courses

loading types…

What you'll learn

  • Create an application from a compiled testing module with createNestApplication() and init(), configured as main.ts configures it
  • Send requests with supertest and assert status, body and headers in its expect() forms
  • Manage one application per file with beforeAll and afterAll, and know what an e2e test proves that a unit test cannot