mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
Runs the storage conformance suite, the schema migration, an alarm-woken sleep across an eviction, and a turn recovered through the recovery alarm in workerd via @cloudflare/vitest-plugin (npm run test:workers). fix(durable): decline background timers in Cloudflare Workers. With nodejs_compat, timers have an unref(), so the idle-memory timers were armed and a pending one kept a Durable Object from hibernating or being evicted.
24 lines
937 B
TypeScript
24 lines
937 B
TypeScript
import { fileURLToPath } from "node:url";
|
|
import { cloudflareTest } from "@cloudflare/vitest-plugin";
|
|
import { defineConfig } from "vitest/config";
|
|
|
|
const source = (path: string) => fileURLToPath(new URL(path, import.meta.url));
|
|
|
|
// Runs in workerd: the Durable Object storage, alarms, and eviction are Cloudflare's own.
|
|
export default defineConfig({
|
|
root: source("."),
|
|
plugins: [cloudflareTest({ wrangler: { configPath: source("./wrangler.jsonc") } })],
|
|
test: { include: ["*.test.ts"] },
|
|
resolve: {
|
|
conditions: ["source"],
|
|
alias: [
|
|
{ find: /^@earendil-works\/pi-durable$/, replacement: source("../src/index.ts") },
|
|
{ find: /^@earendil-works\/pi-durable\/testing$/, replacement: source("../src/testing/index.ts") },
|
|
{
|
|
find: /^@earendil-works\/pi-durable\/storage\/sqlite\/cloudflare$/,
|
|
replacement: source("../src/storage/sqlite/cloudflare.ts"),
|
|
},
|
|
],
|
|
},
|
|
ssr: { resolve: { conditions: ["source"] } },
|
|
});
|