Prathya JS
Contract-Driven Requirement Coverage for JavaScript & TypeScript
Prathya is an open-source tool that brings formal requirement traceability to software testing. It treats requirements as first-class, versioned artifacts, links tests to those requirements via annotations, and measures requirement coverage — a more meaningful quality signal than code coverage alone.
The Core Insight
Code coverage tells you what was touched. Requirement coverage tells you whether intent was verified.
Prathya introduces Contract-Driven Development (CDD) as a natural companion to established methodologies:
| Methodology | Focus | Gap |
|---|---|---|
| TDD | Write the test first, then the code | Drives implementation but says nothing about whether the tests are the right tests |
| BDD | Write behavior specifications in natural language | Improves communication but doesn't enforce traceability or coverage measurement |
| CDD | Define the contract first. Tests are written against the contract | The contract is the source of truth — not the code, not the tests, not a ticket |
Quick Start
1. Install
2. Create CONTRACT.yaml
module:
id: AUTH
name: Auth Service
description: Handles user authentication
requirements:
- id: AUTH-001
version: 1.0.0
status: approved
title: User login with valid credentials
description: >
The system must authenticate a user given valid credentials,
returning a signed JWT.
acceptance_criteria:
- Returns HTTP 200 with a JWT in the response body
corner_cases:
- id: AUTH-001-CC-001
description: Invalid password — must return 401
changelog:
- version: 1.0.0
date: "2026-01-01"
note: Initial definition
3. Annotate your tests
4. Configure the reporter
5. Run
Prathya produces an HTML report at pratya-report/index.html and a JSON report at pratya-report/pratya-report.json.
What's Next
- Concepts — understand Contract-Driven Development in depth
- CONTRACT.yaml Reference — full schema and field reference
- Integrations — Vitest, Playwright, and Jest setup
- CLI — command reference
- MCP Server — AI agent integration via Model Context Protocol
- Audit Rules — what Prathya checks and how to configure it