testing-vitest

Write integration and end-to-end tests for NestJS and MikroORM with transaction rollback.

3|2|Updated Nov 13, 2025
One-click install
npx skills add https://github.com/bloominggrace/create-fullstack-service --skill testing-vitest-bloominggrace
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-vitest
Source: https://github.com/bloominggrace/create-fullstack-service/tree/main/.cursor/skills/testing-vitest
Command: npx skills add https://github.com/bloominggrace/create-fullstack-service --skill testing-vitest-bloominggrace

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies the process of writing robust integration and end-to-end tests for NestJS applications utilizing MikroORM, ensuring data integrity through transaction rollbacks and real database integration.

Core Features & Use Cases

  • Integration Testing: Write tests for service layers with real database connections and transaction rollback.
  • E2E Testing: Test full API endpoint flows.
  • Test Structure Guidance: Provides clear patterns for describe and test block naming, DTO generation, and test fixture separation.
  • Vitest Configuration: Includes setup for Vitest, including global setup for database seeding.

Quick Start

Use the testing-vitest skill to write integration tests for your NestJS services by following the provided structure and transaction rollback pattern.

Frequently Asked Questions about testing-vitest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write integration tests for NestJS with MikroORM and Vitest?

To write NestJS and MikroORM integration tests with Vitest, you establish a real database connection and enforce transaction rollback for test isolation. This approach ensures data integrity by automatically rolling back database changes after each test case executes.

Why does my MikroORM test data persist across test runs in Vitest?

MikroORM test data persists across runs if transaction rollback is not enforced. Implementing a transaction rollback pattern wraps each test in a database transaction that is rolled back, ensuring complete test isolation and preventing data leakage between test suites.

Can I test full API endpoint flows in NestJS using Vitest?

Yes, you can test full API endpoint flows in NestJS using Vitest for end-to-end testing. This involves configuring the E2E testing environment to handle real database interactions, utilizing global setup for database seeding, and applying transaction rollbacks.

What is the best way to structure Vitest test files for NestJS service layers?

The best way to structure Vitest files for NestJS service layers involves separating test fixtures, generating DTOs accurately, and following strict naming conventions for describe and test blocks. This structured pattern ensures maintainable and readable integration tests.

Does Vitest global setup support database seeding for MikroORM?

Yes, Vitest global setup supports database seeding for MikroORM. You can configure the global setup file to initialize your database connection and seed necessary fixture data before executing your integration and end-to-end test suites.