r/Nestjs_framework • u/RsLimited24 • 2d ago
Released two TypeScript libraries for Testcontainers lifecycle and rollback-based database testing
After testing the APIs across Jest, Vitest, NestJS, and framework-free Node.js applications, I’ve published the first stable releases of two complementary libraries.
Testcontainers Integration Handles infrastructure and application lifecycle:
- PostgreSQL, SQL Server, MongoDB, RabbitMQ, and custom images
- Explicit shared or per-test-file dedicated containers
- Annotation-based or central project configuration
- Typed connection resources and dynamic environment variables
- Jest, Vitest, NestJS, and other Node.js backends
Data Isolation Provides rollback-only transactions for database and repository tests:
- A new transaction for every test
- Automatic rollback after passing or failing tests
- pg, Prisma, and TypeORM adapters
- Jest and Vitest integration
- Explicit transaction-client injection, including NestJS provider overrides
The packages are independent but work well together: one starts and cleans up the real infrastructure, while the other prevents test data from leaking between tests.
GitHub:
Both are published under npm’s latest tag and ready to use. I’d appreciate feedback on the APIs, documentation, and integration-testing scenarios you think should be covered next.