testing

Write and organize runtime and type tests in TypeScript projects.

2|Updated Mar 19, 2024
One-click install
npx skills add https://github.com/yankeeinlondon/typed-tester --skill testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/yankeeinlondon/typed-tester/tree/main/.claude/skills/testing
Command: npx skills add https://github.com/yankeeinlondon/typed-tester --skill testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires simple-git, and includes scripts (resource) components.

What problem does it solve?

This Skill provides expert guidance on writing effective and comprehensive tests in TypeScript, addressing the nuances of both runtime behavior and type correctness. It helps developers integrate robust testing practices, avoid common mistakes, and ensure high code quality through a structured Test-Driven Development (TDD) workflow.

Core Features & Use Cases

  • Dual Testing Expertise: Offers clear instructions on when and how to apply both runtime (e.g., Vitest) and type (e.g., inferred-types) tests, crucial for modern TypeScript projects.
  • TDD Workflow Integration: Details a structured 5-step TDD process (Snapshot, Log, Write Tests, Implement, Close Out) to systematically build and verify features.
  • Common Mistakes & Best Practices: Highlights frequent errors in type testing and provides general testing principles for creating maintainable, high-quality, and deterministic tests.
  • Use Case: When developing a new TypeScript function or component, activate this Skill to get immediate, context-aware advice on structuring your tests, choosing the appropriate testing approach (runtime vs. type), and following a TDD cycle to build reliable and type-safe code.

Quick Start

To capture the initial state for a new testing phase (e.g., "my-feature-test", phase 1):

bun run .claude/skills/testing/scripts/start-position.ts my-feature-test 1

Frequently Asked Questions about testing

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

FAQPage Schema
How do I write both runtime and type tests in TypeScript?

Runtime and type tests serve different purposes in TypeScript projects. Runtime tests use Vitest to verify behavior; type tests use utilities like Expect and AssertEqual to verify type correctness. This Skill teaches when to apply each approach and how to structure both alongside your code for comprehensive coverage.

What is Test-Driven Development and how do I follow a TDD workflow?

TDD is a development cycle where you write tests before implementation. This Skill details a 5-step TDD process: capture initial state (Snapshot), log observations, write tests, implement the feature, and close out. Following this workflow ensures your code meets requirements and maintains type safety.

How do I organize and structure tests in a TypeScript project?

Effective test organization requires clear structure and consistent conventions. This Skill provides guidance on arranging runtime tests with Vitest and type tests with type-test utilities, including test naming, assertion patterns (Expect, AssertTrue, AssertFalse, AssertExtends), and linting conventions for maintainable, deterministic tests.

What are common mistakes in TypeScript type testing?

Type tests often fail due to incorrect assertion syntax or misunderstanding type inference. This Skill highlights frequent errors in type testing and explains best practices for writing reliable type assertions, helping you avoid pitfalls and ensure your types behave as expected.

Can I use Vitest for both runtime and type testing in TypeScript?

Vitest handles runtime tests directly, but type testing requires separate utilities like inferred-types or type-test. This Skill explains how to integrate Vitest for runtime tests (pnpm test) and type-test utilities for type validation (pnpm test:types) in a unified testing strategy.

How do I ensure code quality and reliability in TypeScript projects?

Comprehensive testing covering both runtime behavior and type correctness ensures software reliability. This Skill teaches how to write effective tests, adopt TDD practices, and integrate testing tools to maintain high code quality and catch errors before production.