Add missing test/setup-scm-loader.ts preload for .scm imports - #1286
Add missing test/setup-scm-loader.ts preload for .scm imports#1286lab1207 wants to merge 2 commits into
Conversation
cli/bunfig.toml lists test/setup-scm-loader.ts among its preloads, but the file was never exported to the public mirror. Any test reaching the SDK barrel (which re-exports code-map, which imports .scm tree-sitter query files) threw "Unknown file type" at import time, which bun surfaces as an unhandled error between tests — a fresh clone showed a wall of dead test files with no obvious cause. The plugin registers a bun loader that imports .scm files as a default-exported string, matching what the bundled build does. Verified against the CLI suite: 1,576 pass, with only the pre-existing Windows-path failures in export-conversation.test.ts remaining (unrelated). 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
Good catch and a clean, minimal fix. This is exactly the kind of gap you'd expect from a squashed export: The fix itself is sound: a A few things worth double-checking before this is ported:
Overall: small, correctly diagnosed, verified against the actual failure mode. Worth a maintainer's few minutes to confirm and port. |
Per review on CodebuffAI#1286: nothing asserted the loader behavior itself. This imports the go tree-sitter query .scm directly and asserts it arrives as a non-empty string with capture syntax intact. Without the preload the file fails to load at all (verified: running it without the cli/bunfig preload fails), so a future refactor cannot silently regress the loader. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
Thanks for the review! Pushed 9317d5c addressing the actionable ask:
On the other two asks:
CLI suite on Windows 11 / bun 1.3.14 after the new commit: 1,584 pass, only |
Problem
cli/bunfig.tomllists three test preloads:But
test/setup-scm-loader.tsdoes not exist in the public mirror. Any test thatreaches
@codebuff/sdk(which re-exports code-map, which imports.scmtree-sitter query files) dies at import time with "Unknown file type" — which bun
reports as "Unhandled error between tests", so a fresh clone shows a wall of
failing test files with no obvious cause. (The same file is referenced in
docs/testing.md, there under a corrupted path
../test/n.ts.)Fix
One new file: a bun
plugin()that loads.scmimports as a default-exportedstring — the same thing the bundled build does. Registered via the preload that
bunfig.toml already declares, so no config change is needed.
Verification
cd cli && bun test src/commands src/utils/__tests__ src/state:export-conversation.test.ts (expects
/project/..., gets\project\...) —present on main without this change, happy to file a separate issue for those
Tested on Windows 11 / bun 1.3.14.