finds.dev← search

// the find

jmcdo29/testing-nestjs

★ 3,015 · TypeScript · MIT · updated Apr 2025

A repository to show off to the community methods of testing NestJS including Unit Tests, Integration Tests, E2E Tests, pipes, filters, interceptors, GraphQL, Mongo, TypeORM, and more!

A monorepo of about twenty small NestJS apps under apps/, each built to show one testing approach: unit tests for services, controllers, guards, pipes and interceptors, e2e tests with supertest or pactum, and integration against Mongo, TypeORM, Prisma and microservice transports. It is a reference for developers who have written Nest apps and want to see how the testing utilities fit together, not a guide to one testing philosophy.

complex-sample tests each Nest primitive on its own. cat.guard.spec.ts, cat.interceptor.spec.ts and cat.pipe.spec.ts sit next to the controller and service specs, so you can see how each piece is tested without booting the whole module. complex-sample and graphql-sample both include app.e2e-spec.ts and app.pactum.e2e-spec.ts, which makes the supertest-versus-pactum choice easy to compare directly. prisma-sample runs against a real database with checked-in migrations, a docker-compose file and a setup script instead of mocking the client, which is the most reusable pattern here when your own tests need a real schema. mongodb-transaction-sample covers transactions, which most Nest testing examples skip.

The last push was 2025-04-27. Nothing in the metadata shows the apps being moved to newer Nest releases, and with about twenty apps sharing one root lockfile, an upgrade touches all of them at once, so check the version pins before copying anything. The onboarding steps don't match the layout. The README says to cd into a folder, run npm install and treat each folder as 'a fully functional Nest application on its own', but the samples live under apps/ and the listing shows no package.json in any of them. Dependencies and scripts come from the root workspace, so the README path does not work as written. The samples are mostly CRUD on a cat resource, and the tests mock the service or repository. That keeps the examples readable, but the harder cases (authorization that depends on request context, error mapping across layers, multi-step writes) are mostly absent outside the Mongo transaction sample.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →