diff
Compare legacy and modern system behavior to verify parity.
npx modernizespec diff [options]What It Does
Section titled “What It Does”- Reads
parity-tests.jsonfor baseline locations and test suites - Runs the specified test commands for each context
- Compares outputs against legacy baselines
- Reports deviations with field-level detail
Options
Section titled “Options”| Flag | Description | Default |
|---|---|---|
--dir <path> | Project directory | Current directory |
--context <name> | Compare a specific context only | All contexts |
--tolerance <n> | Numeric precision tolerance | 0.001 |
--json | Output diff as JSON | Human-readable |
--baseline <path> | Override baseline directory | From parity-tests.json |
Examples
Section titled “Examples”Diff All Contexts
Section titled “Diff All Contexts”npx modernizespec diffDiff Specific Context
Section titled “Diff Specific Context”npx modernizespec diff --context AccountsWith Custom Tolerance
Section titled “With Custom Tolerance”npx modernizespec diff --tolerance 0.01Output
Section titled “Output”Parity Diff — AccountsBaseline: legacy-snapshots/accounts/Tests: 72 total
✓ 68 tests match baseline ✗ 4 tests deviate
Deviations: tax_inclusive_rounding: Legacy: 1,847.46 Modern: 1,847.47 Delta: +0.01 (precision difference)
advance_payment_allocation: Legacy: allocated_amount = 5,000.00 Modern: allocated_amount = 4,999.99 Delta: -0.01 (rounding order difference)
Summary: 94.4% parity (threshold: 95.0%)Status: ⚠ Below threshold — review deviationsExit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 | Parity meets or exceeds threshold |
1 | Parity below threshold |
2 | Baseline or spec files not found |
See Also
Section titled “See Also”- parity-tests.json Specification — Test inventory format
- export — Export diff results as HTML report