testing

Write pytest and Vitest tests with fixtures, mocks, and coverage.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides expert guidance and code examples for writing effective tests in Python (pytest) and TypeScript (Vitest), ensuring code quality and reliability.

Core Features & Use Cases

  • Test Structure: Demonstrates basic and advanced test writing patterns.
  • Fixtures & Mocks: Shows how to set up test environments and isolate dependencies.
  • Framework Specifics: Covers async testing, HTTP testing (Litestar), and component testing (React/Vue).
  • Coverage: Guides on achieving and enforcing code coverage targets.
  • Use Case: When you need to write a new test suite for a Python API endpoint or a React component, this skill provides the necessary patterns and examples to get started quickly and correctly.

Quick Start

Use the testing skill to generate a basic pytest test function for a Python function.

Frequently Asked Questions about testing

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

FAQPage Schema
How do I write unit tests with pytest for a Python function?

Writing unit tests with pytest involves creating functions that assert expected behavior. This skill provides structural patterns, fixtures for environment setup, and mocking techniques to isolate dependencies and validate Python code deterministically.

How do I use Vitest to test TypeScript components?

Testing TypeScript components with Vitest involves importing components and rendering them within test blocks. This skill provides examples for React and Vue component testing, covering mocks and async tests to validate UI behavior reliably.

How do I set up fixtures and mocks for integration testing in Python?

Setting up fixtures and mocks for integration testing uses pytest's fixture system to manage state and dependency isolation. This skill demonstrates configuring test environments and mocking external calls to ensure deterministic validation.

Can I test async Python API endpoints and HTTP routes with these frameworks?

Yes, you can test async Python API endpoints and HTTP routes. This skill covers async testing and provides specific HTTP testing patterns using Litestar to validate endpoint request and response cycles correctly.

What is the best way to enforce code coverage targets in TypeScript and Python?

Enforcing code coverage targets involves configuring your test runner to track executed lines and fail builds below a threshold. This skill guides on achieving and enforcing coverage metrics for both Vitest and pytest test suites.

Why are my async Vitest tests failing when mocking dependencies?

Async Vitest tests often fail due to improper mock resolution or missing await keywords. This skill provides expert guidance on writing async tests and isolating dependencies correctly to ensure reliable and deterministic test execution.