Skip to content

Add missing test/setup-scm-loader.ts preload for .scm imports - #1286

Open
lab1207 wants to merge 1 commit into
CodebuffAI:mainfrom
lab1207:fix/missing-scm-loader
Open

Add missing test/setup-scm-loader.ts preload for .scm imports#1286
lab1207 wants to merge 1 commit into
CodebuffAI:mainfrom
lab1207:fix/missing-scm-loader

Conversation

@lab1207

@lab1207 lab1207 commented Sep 6, 2026

Copy link
Copy Markdown

Problem

cli/bunfig.toml lists three test preloads:

preload = [
  "../sdk/test/setup-env.ts",
  "../test/setup-scm-loader.ts",
  "./test/setup-agents-artifact.ts",
]

But test/setup-scm-loader.ts does not exist in the public mirror. Any test that
reaches @codebuff/sdk (which re-exports code-map, which imports .scm
tree-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 .scm imports as a default-exported
string — 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:

  • 1,576 pass with this change
  • 13 failures remain, all pre-existing Windows path-separator issues in
    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.

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>
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