// Bundle tests are tests concerning bundling bugs that only occur in DevServer. import { devTest, minimalFramework, Step } from "../dev-server-harness"; devTest("import identifier doesnt get renamed", { framework: minimalFramework, files: { "db.ts": `export const abc = "123";`, "routes/index.ts": ` import { abc } from '../db'; export default function (req, meta) { let v1 = ""; const v2 = v1 ? abc.toFixed(2) : abc.toString(); return new Response('Hello, ' + v2 + '!'); } `, }, async test(dev) { await dev.fetch("/").expect("Hello, 123!"); await dev.write("db.ts", `export const abc = "456";`); await dev.fetch("/").expect("Hello, 456!"); await dev.patch("routes/index.ts", { find: "Hello", replace: "Bun", }); await dev.fetch("/").expect("Bun, 456!"); }, }); devTest("symbol collision with import identifier", { framework: minimalFramework, files: { "db.ts": `export const abc = "123";`, "routes/index.ts": ` let import_db = 987; import { abc } from '../db'; export default function (req, meta) { let v1 = ""; const v2 = v1 ? abc.toFixed(2) : abc.toString(); return new Response('Hello, ' + v2 + ', ' + import_db + '!'); } `, }, async test(dev) { await dev.fetch("/").expect("Hello, 123, 987!"); await dev.write("db.ts", `export const abc = "456";`); await dev.fetch("/").expect("Hello, 456, 987!"); }, });