Skip to content

Testing Documentation

This section covers the testing mechanisms and quality assurance tools for PromptScript formatters.

Overview

PromptScript provides comprehensive testing to ensure formatter quality and consistency:

flowchart TB
  subgraph "Quality Assurance"
    PM[Parity Matrix] --> |Validates| Consistency[Formatter Consistency]
    GF[Golden Files] --> |Validates| Output[Output Correctness]
    FC[Feature Coverage] --> |Tracks| Capabilities[Tool Capabilities]
  end

Testing Mechanisms

Quick Reference

Running Tests

Terminal window
# Run all formatter tests
pnpm nx test formatters
# Run parity tests only
pnpm nx test formatters --testNamePattern="Parity"
# Run golden file tests
pnpm nx test formatters --testNamePattern="Golden Files"
# Run feature coverage tests
pnpm nx test formatters --testNamePattern="Feature Coverage"
# Update golden files after intentional changes
UPDATE_GOLDEN=true pnpm nx test formatters

Test Files

Test FilePurpose
parity-matrix.spec.tsSection coverage validation
golden-files.spec.tsOutput comparison against references
feature-coverage.spec.tsFeature implementation verification
parity.spec.tsCross-formatter consistency

Key Exports

@promptscript/formatters is not published to npm, so these imports work inside the PromptScript repository only.

import {
// Parity Matrix
PARITY_MATRIX,
getRequiredSections,
analyzeFormatterOutput,
// Feature Coverage
FEATURE_MATRIX,
getToolFeatures,
toolSupportsFeature,
getFeatureCoverage,
} from '@promptscript/formatters';

CI/CD Integration

Testing is integrated into the CI pipeline:

  1. Unit Tests - All formatter tests run on every push
  2. Golden Files Check - Detects drift in formatter output
  3. Coverage Reports - Tracks test coverage metrics

See Parity Testing - CI/CD Integration for details.