Skip to content

Facet is a modern testing framework that lets you document features from multiple stakeholder perspectives while maintaining exact traceability to your tests.

License

Notifications You must be signed in to change notification settings

iraycd/facet-coverage

Repository files navigation

Facet Coverage

Test every facet of your features

Write requirements naturally. Know what's tested. Track multi-stakeholder coverage automatically.

npm version License: MIT CircleCI Node.js Version


Why Facet?

Traditional testing asks "what did developers test?" Facet asks "what do stakeholders need, and is it tested?"

Real products serve multiple stakeholders—product owners, compliance teams, UX designers, security architects—each with their own requirements. Facet lets every stakeholder write requirements in natural language, then tracks whether tests actually cover them.

One feature. Many facets. All tracked.


Quick Start

Install

bun add -d @facet-coverage/core

1. Each stakeholder writes their requirements

Business Teamfacets/business.md

## Guest Purchase Flow
Users should complete purchases without creating an account.

Compliance Teamfacets/compliance.md

## PCI-DSS Payment Requirements
1. **Encryption in transit** [](#tls) - TLS 1.2+ required
2. **No CVV storage** [](#cvv) - Never store CVV
3. **Card masking** [](#masking) - Show only last 4 digits

UX Teamfacets/ux.md

## Mobile Checkout Experience
Large touch targets (44px min), single column layout, inline validation.

2. Tests link to requirements

import { Facets, facet } from '../.facet/facets';

test('guest user completes purchase on mobile', () => {
  // This test proves requirements for 3 different stakeholders
  facet(Facets.BUSINESS_GUEST_PURCHASE_FLOW);
  facet(Facets.COMPLIANCE_PCI_DSS);
  facet(Facets.UX_MOBILE_CHECKOUT_EXPERIENCE);

  const order = checkout(cart, 'user@example.com', '4242424242424242');

  expect(order.confirmed).toBe(true);
  expect(order.maskedCard).toBe('•••• 4242');  // PCI-DSS compliance
});

test('TLS encryption enforced', () => {
  // Track specific compliance sub-requirements
  facet(Facets.COMPLIANCE_PCI_DSS__TLS);

  expect(paymentEndpoint.protocol).toBe('https');
});

3. See coverage across all perspectives

bunx facet analyze
Facet Coverage Report
Overall: 83% (5/6)

  business:   100% (1/1)  ✓
  compliance:  80% (4/5)
    ✗ pci-dss/cvv - No CVV storage
  ux:         100% (1/1)  ✓

Now you know: The compliance team's CVV requirement isn't tested yet.


Documentation

Guide Description
Getting Started Full quickstart with project structure
Core Concepts What Facet is and how it works
Configuration Config options and examples
CLI Reference All available commands
Playwright Integration Enhanced Playwright support
Programmatic API Use Facet in code
ID Patterns Stable IDs, sub-facets, and nested features

Background

Document Description
Vision Philosophy behind multi-stakeholder coverage
Testing Phases Where Facet fits in testing
Comparisons How Facet differs from BDD, Cucumber, etc.

Key Features

  • Natural language - Write requirements as Markdown, no Gherkin syntax
  • Multi-perspective - Business, compliance, UX, technical facets per feature
  • Sub-facets - Track fine-grained requirements with hierarchical IDs
  • Type-safe linking - Generated TypeScript types prevent broken references
  • Framework agnostic - Works with Jest, Vitest, Playwright, Mocha, Bun
  • Gap detection - See what's untested across all stakeholder perspectives
  • Live dashboard - facet serve for real-time coverage with hot reload
  • CI-ready - Threshold enforcement and JSON output for pipelines

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see the LICENSE file for details.