| 1 | import { createMiniflareFromRolldown } from "../../../../cloudflare-test-tools/src/miniflare/miniflare.ts"; |
| 2 | import { assert, describe, expect, it } from "vitest"; |
| 3 | import { buildFixture } from "./utils/build-fixture.ts"; |
| 4 | |
| 5 | describe("regression", () => { |
| 6 | it.skipIf(!process.env.TEST_MYSQL_URL)("bundles mysql2", async () => { |
| 7 | assert(process.env.TEST_MYSQL_URL, "TEST_MYSQL_URL is not set"); |
| 8 | const pluginOptions = { |
| 9 | compatibilityDate: "2025-07-01", |
| 10 | compatibilityFlags: ["nodejs_compat"], |
| 11 | }; |
| 12 | const built = await buildFixture({ |
| 13 | fixture: "regression/mysql2", |
| 14 | pluginOptions, |
| 15 | }); |
| 16 | await using miniflare = await createMiniflareFromRolldown(built.output, { |
| 17 | ...pluginOptions, |
| 18 | bindings: { |
| 19 | DATABASE_URL: process.env.TEST_MYSQL_URL, |
| 20 | }, |
| 21 | }); |
| 22 | expect(await miniflare.fetchJson<{ sql: string }>("/")).toMatchObject({ |
| 23 | sql: "SELECT 1", |
| 24 | }); |
| 25 | }); |
| 26 | }); |