Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

test: let the TypeScript test loader handle .json imports

Aaron Coville727b4f56d5e6
diff --git a/test/load-ts.cjs b/test/load-ts.cjs
index c8a255d3..16db6ee7 100644
--- a/test/load-ts.cjs
+++ b/test/load-ts.cjs
@@ -19,6 +19,14 @@ function resolveTs(fromDir, request) {
function loadFile(filename) {
const cached = cache.get(filename);
if (cached) return cached.exports;
+ // A `.json` import is data, not TypeScript. The bundler parses it (the app
+ // compiles with resolveJsonModule); handing it to transpileModule instead
+ // fails output generation outright, so parse it the same way here.
+ if (filename.endsWith('.json')) {
+ const json = { exports: JSON.parse(fs.readFileSync(filename, 'utf8')) };
+ cache.set(filename, json);
+ return json.exports;
+ }
const source = fs.readFileSync(filename, 'utf8');
const output = ts.transpileModule(source, {
compilerOptions: {