How can I make miniflare persit R2 data on local in testing?
I have a worker and it need to access R2. I want to run test locally and make R2 load files from local dir.
are there any options I can add here?
are there any options I can add here?
export default defineWorkersConfig({
test: {
poolOptions: {
workers: {
wrangler: { configPath: './wrangler.toml' },
miniflare: {
r2Buckets: {
MY_BUCKET: 'sing-box-config',
// 'sing-box-config': 'MY_BUCKET',
},
},
},
},
},
});setupFiles (https://vitest.dev/config/#setupfiles) with something like...BINDING: name setupFilesBINDING: name// vitest.config.ts
export default defineWorkersProject({
test: {
setupFiles: ["./test/seed-data.ts"],
poolOptions: { ... },
},
});// test/seed-data.ts
import { env } from "cloudflare:test";
await env.MY_BUCKET.put("key", "value");
// ...