Skip to content

chore: migrate AST chunking tests to vitest#485

Open
jamesrisberg wants to merge 1 commit intotobi:mainfrom
jamesrisberg:chore/migrate-ast-tests-to-vitest
Open

chore: migrate AST chunking tests to vitest#485
jamesrisberg wants to merge 1 commit intotobi:mainfrom
jamesrisberg:chore/migrate-ast-tests-to-vitest

Conversation

@jamesrisberg
Copy link
Copy Markdown
Contributor

@jamesrisberg jamesrisberg commented Mar 29, 2026

Summary

Builds on #449

Replaces the standalone test-ast-chunking.mjs script (823 lines, custom check() harness) with a proper vitest test file. The script ran outside the test pipeline and was invisible to CI.

Changes

  • Deleted test-ast-chunking.mjs
  • Added test/ast-chunking.test.ts — 12 integration tests covering areas not already tested by test/ast.test.ts:
    • mergeBreakPoints score precedence and position sorting
    • AST vs regex split comparison on a 30-function file
    • Markdown regression (identical chunks in auto vs regex mode)
    • "regex" strategy bypass, no-filepath fallback, small file → single chunk
    • chunkDocumentWithBreakPoints equivalence with chunkDocument
    • Break point score assertions: TS export=90, Python class=100, Go type=80, Rust enum=80

What was intentionally dropped

  • Performance benchmarks — timing loops that printed to stdout, not assertions
  • Real collection scanner — CLI dev tool for manual profiling against real codebases
  • Duplicate tests — language detection, per-language breakpoints, and error handling already covered by test/ast.test.ts

Test plan

  • 38/38 tests pass (26 existing + 12 new)
  • No source code changes — test-only PR
  • Net −651 lines

Replace standalone test-ast-chunking.mjs (823 lines, custom check()
harness, invisible to CI) with proper vitest integration tests.

All unique assertions preserved; duplicates already in ast.test.ts
dropped. Performance benchmarks and real-collection scanner removed
(dev tools, not regression tests).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jamesrisberg jamesrisberg marked this pull request as ready for review March 29, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant