pi-mono/packages/durable/test/codemode-imports.test.ts
Armin Ronacher 748cd5ac57 feat(coding-agent): run code mode on dquickts instead of quickjs-wasi
Code mode scripts now run on @earendil-works/dquickts 0.2.0 (Bellard's
QuickJS compiled to WebAssembly) instead of quickjs-wasi (QuickJS-NG):
about 1.3 to 1.9 times faster, with a larger wasm (about 850 KB).

- Deep recursion fails with InternalError: stack overflow instead of
  RangeError; the inline and remote sandboxes allow about 950 calls.
- Deterministic runs: the fingerprint names the engine, and Math.random()
  gives other values for a seed.
- Tests: no tool runs after an interrupted async function, and a loop of
  interrupted async functions ends with a timeout.
2026-10-31 15:45:59 +01:00

11 lines
495 B
TypeScript

import { expect, test, vi } from "vitest";
import { createCodemodeExtension } from "../src/codemode/codemode.ts";
// The extension runs scripts in the sandbox the host passes, so loading it must not load the WASM VM (#11254).
vi.mock("@earendil-works/dquickts", () => {
throw new Error("the Code Mode extension loaded @earendil-works/dquickts");
});
test("the Code Mode extension loads without pi-codemode's WASM runtime", () => {
expect(createCodemodeExtension).toBeTypeOf("function");
});