Larry thank you for the response How
Larry, thank you for the response. How close are you with the article? There are a bunch of questions on this. Do you have any code snippets, especially in Typescript?
onRequest, onRequestPost, etc. Import that. You are going call it with the first parameter being a Request object you compose, the second parameter that comes from getMiniflareBindings() (plus any that you add after you call that), and the third parameter an object you compose yourself if you need it (most of my functions do not).getMiniflareBindings() from your test code and then pass them into the appropriate position in the call to your handler.onRequestonRequestPostgetMiniflareBindings()getMiniflareBindings()import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
environment: "miniflare",
// Configuration is automatically loaded from `.env`, `package.json` and
// `wrangler.toml` files by default, but you can pass any additional Miniflare
// API options here:
environmentOptions: {
bindings: { KEY: "value" },
kvNamespaces: ["TEST_NAMESPACE"],
},
},
})export default {
testEnvironment: "miniflare",
// Configuration is automatically loaded from `.env`, `package.json` and
// `wrangler.toml` files by default, but you can pass any additional Miniflare
// API options here:
testEnvironmentOptions: {
bindings: { KEY: "value" },
kvNamespaces: ["TEST_NAMESPACE"],
},
};