Conversation
cli/bunfig.toml lists ../test/setup-scm-loader.ts as a preload and the repo does not contain it, so bun aborts on the first unresolvable preload and no test in the package runs. Add the loader both that config and docs/testing.md already reference, so a .scm query arrives as its text instead of a path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cli/bunfig.tomlpreloads../test/setup-scm-loader.ts, and that file is not in this repo (git ls-files test/is empty). bun stops on the first preload it cannot resolve, so the command the docs give for this package never starts:docs/testing.mdpasses the same path to--preloadin its leak-reproduction example, so a reader copying that line hits it too. This PR adds the loader the two references already expect.What the loader does
Bun resolves an import of an extension it does not know to the file's path.
packages/code-map/src/languages.tsalready reads that path back off disk when it is absolute — the code comment there says as much — which is why the CLI works without this file. But the query then only arrives as text in the one case where the path happens to be absolute and readable, and a bundler that inlines the import has no file to read at all.bun 1.3.14 has no
loader: 'text', so the emitted module isexport defaultfollowed by the JSON-escaped text. Measured, importing one of the real query files:import q from '…/tree-sitter-c_sharp-tags.scm'(class_declaration\n name: (identifier) @identifier\n…— the text/home/…/packages/code-map/src/tree-sitter-queries/…— an absolute pathBefore / after
cd cli && bun testerror: preload not foundThe 4 extra tests are the new file's. The failure set is unchanged: the same file list run from the repo root, which is the only invocation that started before this change, reports the same 20 failures and the same 18 errors (
diffof the failure names is empty).Worth saying where those come from, since they are now visible in the documented command:
Failed to load CLI environment via packages/internal/src/env. That package is out of this mirror's scope.require('tar'), which is not installed.Not in this PR, on purpose
cli/package.jsonruns the suite asNODE_ENV=production bun test …. With that variable set,react/jsx-dev-runtimeresolves to React's production stub, and all 54 tests infreebuff-model-selector.test.tsxfail atjsxDEV is not a function. Unsetting it brings every one of them back. That is a question about the script's environment, not about this preload, so it is left as it is here and reported rather than bundled in.Verification
cli/src/__tests__/scm-loader.test.ts: 4 tests, 0 fail. They import what the loader emits from a temp file, so the escaping is covered by a real module load rather than by string comparison.tsc --noEmitreports 10 errors, the same count as on main, none of them in the files added here.