codeModeMessages turns what I say plus `about` into a prompt: a neighbor persona, rules for the reply (one async arrow function over `env`), and the lent things' types. Things are remote and calls on one are delivered in order, so a lamp example shows pipelining: await only for a value, or on a batch's last call. With only the rule, the model awaited every call; with the example, it pipelines. aboutMower gives the Mower type with Promise returns. The model test checks the code calls only Mower methods, pushes, and awaits less often than it calls; it saves the code to itest-output/ via a reporter, since the test runs in workerd, which can't write files. Model tests get 60s. Green: both model tests. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
14 lines
530 B
TypeScript
14 lines
530 B
TypeScript
import { defineProject } from "vitest/config";
|
|
import { cloudflareTest } from "@cloudflare/vitest-plugin";
|
|
|
|
/** opt-in (`pnpm test:model`): calls Workers AI, which needs `wrangler login` and costs money */
|
|
export default defineProject({
|
|
plugins: [cloudflareTest({ wrangler: { configPath: "./wrangler.model-tests.jsonc" } })],
|
|
test: {
|
|
include: ["itest/**/*.test.ts"],
|
|
testTimeout: 60_000,
|
|
// what the model wrote, saved per run to itest-output/ (gitignored)
|
|
reporters: ["default", "./itest/save-annotations.ts"],
|
|
},
|
|
});
|