Commits
Click on a commit to change the comparison rangetest(formatter): add snapshot-based test infrastructure (#14400)
Implement a flexible snapshot-based testing framework for oxc_formatter using `insta` and build-time test generation.
## Features
- **Auto-discovery**: Tests are automatically discovered from `tests/fixtures/` directory
- **Individual test functions**: Each fixture file gets its own test function for easy identification
- **Hierarchical options**: Support for `options.json` files at any directory level
- **Multiple option sets**: Test the same input with multiple formatting configurations
- **Co-located snapshots**: Snapshot files are stored next to test files (e.g., `foo.js.snap`)
- **Comprehensive README**: Detailed documentation for adding and running tests
## Implementation
- **build.rs**: Scans `tests/fixtures/` and generates test functions at build time
- **tests/fixtures/mod.rs**: Core test infrastructure with option resolution and snapshot generation
- **tests/README.md**: Complete guide for using the test framework
- **Sample tests**: Example tests demonstrating JS, JSX, TS, and nested configurations
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>