testing-strategy

Structure TypeScript unit, integration, and load tests with Vitest and k6.

3|1|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/jagreehal/jagreehal-claude-skills --skill testing-strategy-jagreehal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-strategy
Source: https://github.com/jagreehal/jagreehal-claude-skills/tree/main/skills/testing-strategy
Command: npx skills add https://github.com/jagreehal/jagreehal-claude-skills --skill testing-strategy-jagreehal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a clear, repeatable testing strategy (unit, integration, and load) for TypeScript projects, enabling reliable testability through dependency injection and typed mocks.

Core Features & Use Cases

  • Test Pyramid Guidance: Clear guidance on unit, integration, and load testing balance.
  • DI-driven Tests: Use dependency injection to write isolated unit tests with typed mocks via vitest-mock-extended.
  • Realistic Test Data & Load Testing: Leverage Faker for fake data and k6 for scalable load tests.

Quick Start

  • Install vitest, vitest-mock-extended, @faker-js/faker, and k6 in your project.
  • Organize tests into unit (.test.ts), integration (.test.int.ts), and load tests (load/*.js) following the recommended naming and directory structure.
  • Add a vitest.setup.ts to enforce guardrails (e.g., localhost-only integration tests) and run tests to verify your code quality and scalability.

Frequently Asked Questions about testing-strategy

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

FAQPage Schema
How do I structure unit and integration tests in a TypeScript project?

Structure TypeScript tests by separating unit (*.test.ts) and integration (*.test.int.ts) files to enforce a reliable test pyramid. This naming convention guides the testing workflow and keeps integration tests isolated from unit tests.

What is the best way to mock dependencies in Vitest with TypeScript?

Mock dependencies in Vitest by combining dependency injection with vitest-mock-extended. This pattern provides fully typed, deterministic mocks that isolate units of code and ensure reliable, repeatable test execution.

How does Faker integrate with TypeScript test data generation?

Faker integrates into the TypeScript testing workflow to generate realistic fake data for unit and integration tests. It replaces static mock data, ensuring test inputs mimic real-world scenarios while maintaining deterministic test behavior.

Can I run k6 load testing scripts alongside Vitest in the same project?

Yes, you can run k6 load tests alongside Vitest by placing k6 scripts in a dedicated load/ directory. This isolates load testing workflows from unit and integration tests while maintaining a unified testing strategy.

How do I prevent integration tests from running in non-local environments?

Prevent integration tests from running in non-local environments by adding a vitest.setup.ts file. This setup file enforces guardrails, ensuring integration tests only execute locally and protecting external environments from accidental test data.

Why use dependency injection for TypeScript unit testing?

Use dependency injection for TypeScript unit testing to enable isolated, deterministic tests with typed mocks. This pattern solves unreliable ad-hoc testing by allowing precise control over dependencies via vitest-mock-extended.