Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
610 B · 14 lines
TypeScript
123456789101112131415import { readFileSync } from "node:fs";import { expect, it } from "vitest";
it("keeps theme aliases free of self-references", () => { const css = readFileSync("src/styles.css", "utf8"); const aliases = [...css.matchAll(/(--[\w-]+):\s*var\((--[\w-]+)\)\s*;/g)]; expect(aliases.length).toBeGreaterThan(0); // A self-reference invalidates the token, leaving highlight backgrounds // transparent even when the paired foreground color is applied. const selfReferences = aliases .filter(([, name, target]) => name === target) .map(([, name]) => name); expect(selfReferences).toEqual([]);});