import { readFile } from "node:fs/promises"; import { resolve } from "node:path"; import { describe, expect, it } from "vitest"; const readViteConfigSource = () => readFile(resolve(process.cwd(), "apps/web/vite.config.ts"), "utf8"); describe("vite config integration wiring", () => { it("wires the manual chunk helper into Rollup output without running a build", async () => { const source = await readViteConfigSource(); expect(source).toContain('import { getManualChunkName } from "./app/utils/build/manualChunks";'); expect(source).toMatch(/rollupOptions:\s*{[\s\S]*output:\s*{[\s\S]*manualChunks:\s*getManualChunkName/); }); it("keeps build warning triage connected to Rollup onwarn", async () => { const source = await readViteConfigSource(); expect(source).toContain('import { shouldSuppressBuildWarning } from "./app/utils/build/buildWarningTriage";'); expect(source).toMatch(/onwarn\(warning,\s*defaultHandler\)\s*{[\s\S]*shouldSuppressBuildWarning\(warning\)/); expect(source).toMatch(/defaultHandler\(warning\)/); }); it("keeps production source maps opt-in for Sentry release lanes", async () => { const source = await readViteConfigSource(); expect(source).toContain('process.env.TOOLCTRL_BUILD_SOURCEMAPS === "1"'); expect(source).toContain("process.env.SENTRY_AUTH_TOKEN && buildSourcemapsEnabled"); expect(source).toMatch(/sourcemap:\s*buildSourcemapsEnabled/); }); });