import { describe, expect, it } from 'vitest';
import { Miniflare } from 'miniflare';
describe('MiniflareFun', () => {
it('end-to-end', async () => {
const mf = new Miniflare({
modules: true,
script: `
export default {
async fetch(request, env, ctx) {
return new Response("Hello Miniflare!");
}
}
`,
});
const res = await mf.dispatchFetch('http://localhost:8787/');
console.log(await res.text()); // Hello Miniflare!
await mf.dispose();
expect(true).toBe(true);
});
});
import { describe, expect, it } from 'vitest';
import { Miniflare } from 'miniflare';
describe('MiniflareFun', () => {
it('end-to-end', async () => {
const mf = new Miniflare({
modules: true,
script: `
export default {
async fetch(request, env, ctx) {
return new Response("Hello Miniflare!");
}
}
`,
});
const res = await mf.dispatchFetch('http://localhost:8787/');
console.log(await res.text()); // Hello Miniflare!
await mf.dispose();
expect(true).toBe(true);
});
});