0fe761dc4b
- Added tsconfig.publish.json files to all packages with optimized publish-time configuration. - Updated all package.json scripts with prepublishOnly hooks for correct type checking during publish. - Added @oh-my-pi/omp-stats path mappings to root tsconfig.json for consistent imports. - Added WASM generation script for photon module and integrated into install:dev script.
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index";
|
|
|
|
function createSession(overrides: Partial<ToolSession> = {}): ToolSession {
|
|
return {
|
|
cwd: "/tmp/test",
|
|
hasUI: false,
|
|
getSessionFile: () => null,
|
|
getSessionSpawns: () => "*",
|
|
settings: {
|
|
getImageAutoResize: () => true,
|
|
getLspFormatOnWrite: () => true,
|
|
getLspDiagnosticsOnWrite: () => true,
|
|
getLspDiagnosticsOnEdit: () => false,
|
|
getEditFuzzyMatch: () => true,
|
|
getBashInterceptorEnabled: () => true,
|
|
getBashInterceptorSimpleLsEnabled: () => true,
|
|
getBashInterceptorRules: () => [],
|
|
getPythonToolMode: () => "bash-only",
|
|
getPythonKernelMode: () => "session",
|
|
},
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
describe("createTools python fallback", () => {
|
|
it("falls back to bash when python is requested but disabled", async () => {
|
|
const previous = process.env.OMP_PYTHON_SKIP_CHECK;
|
|
process.env.OMP_PYTHON_SKIP_CHECK = "1";
|
|
const session = createSession();
|
|
const tools = await createTools(session, ["python"]);
|
|
const names = tools.map((tool) => tool.name);
|
|
|
|
expect(names).toEqual(["bash"]);
|
|
|
|
if (previous === undefined) {
|
|
delete process.env.OMP_PYTHON_SKIP_CHECK;
|
|
} else {
|
|
process.env.OMP_PYTHON_SKIP_CHECK = previous;
|
|
}
|
|
});
|
|
});
|