import { readFileSync } from"node:fs";import { defineConfig, typePlugin } from"vitest/config";// A `.wasm` import is a compiled WebAssembly.Module, as the Workers runtime// hands it (src/rules' one module), so the Worker's own source loads here too.const wasmModule: Plugin = { name: "wasm-module", enforce: "pre", load(id) {if (!id.endsWith(".wasm")) returnnull;const bytes = readFileSync(id).toString("base64");return`export default new WebAssembly.Module(Buffer.from(${JSON.stringify(bytes)}, "base64"));`; },};// The scripts' own tests: plain Node (node:sqlite, node:crypto), no Workers pool.exportdefault defineConfig({ plugins: [wasmModule], test: { environment: "node", include: ["scripts/__tests__/**/*.test.ts"], },});