Files
romm/frontend/test/devCssPrefixing.test.ts
Sam Dornan ff3cbce1e9 test(frontend): cover the dev server's CSS prefixing
Nothing exercised the dev CSS path: CI's e2e run serves a production build,
and vitest.config.ts never loads vite.config.js, so dropping `css.transformer`
would leave every check green while Safari below 18.4 lost its blur again.

Drives the real config through Vite's programmatic server and asserts both the
standard and prefixed properties. Removing the transformer fails it.

Also trims the comment above the setting to the two lines the repo allows.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BEtFQ17BQDS52wXosTjcUU
2026-09-18 01:03:27 +00:00

31 lines
1.0 KiB
TypeScript

import path from "node:path";
import { createServer, type ViteDevServer } from "vite";
import { afterAll, beforeAll, describe, expect, it } from "vitest";
// The dev server is the only place this is observable: CI's e2e run serves a
// production build, and vitest.config.ts never loads vite.config.js, so a
// dropped `css.transformer` would leave every other check green.
describe("dev server CSS", () => {
let server: ViteDevServer;
beforeAll(async () => {
server = await createServer({
configFile: path.resolve(process.cwd(), "vite.config.js"),
server: { middlewareMode: true },
logLevel: "error",
});
}, 60_000);
afterAll(async () => {
await server?.close();
});
it("generates vendor prefixes, not only on the build's minify path", async () => {
const result = await server.transformRequest(
"/test/fixtures/prefix-probe.css",
);
expect(result?.code).toMatch(/-webkit-backdrop-filter:\s*blur\(1px\)/);
expect(result?.code).toMatch(/[^-]backdrop-filter:\s*blur\(1px\)/);
});
});