/test/CLAUDE.md
CLAUDE.md at /test/CLAUDE.md
Path: test/CLAUDE.md
test/ — Test Suite
Framework
Tests use vitest with globals: true (no need to import describe/it/expect).
Test Helpers
test-helpers.ts exports testSettings — a DeepPartial<FormatterSettings> with component names that tests were written against. The library ships with empty component arrays by default, so always pass { settings: testSettings } when testing component-specific behavior (e.g., block JSX, container indentation, ignore components).
Test Files
formatter.test.ts— Core formatting: headings, paragraphs, spacing, frontmatter, lists, MDX/JSXhtml-blocks.test.ts— HTML block formatting within MDXmdx-formatter.test.ts— Advanced formatting: JSX, block components, indentation, edge casesurl-autolink.test.ts— URL autolink handlingidempotency.test.ts— Single-pass stability and convergence testsload-config.test.ts— Config file loading and mergingrust-formatter.test.ts— Additional Rust engine testsrust-passthrough.test.ts— Formatting behavior validation (85 tests)
Patterns
- Test files are named
{feature}.test.ts - Tests use inline markdown strings with the
format()API - All tests run through the Rust napi engine
- Typical pattern:
expect(await format(input, { settings: testSettings })).toBe(expected)