fix(lib,scripts): import locally for linting, snapshot tests, dev server (#2172)

Co-authored-by: WalkQuackBack <[email protected]>
This commit is contained in:
uncenterandWalkQuackBack authored and GitHub committed 2026-04-25 21:35:37 -05:00
1 parent dc1fac9639
commit acd47ee987
8 files changed
+302 -18

No files matched your search

@@ -0,0 +1,20 @@
export const snapshot = {};
snapshot[`#lib.rgbify 1`] = `
"/* deno-fmt-ignore */
/* deno-fmt-ignore */
.foo {
--bar: 255, 0, 0;
}
"
`;
snapshot[`#lib.hslify 1`] = `
"/* deno-fmt-ignore */
/* deno-fmt-ignore */
.foo {
--bar: 0, 100%, 50%;
}
"
`;
+40
View File
@@ -0,0 +1,40 @@
import { assertSnapshot } from "@std/testing/snapshot";
import { REPO_ROOT } from "../constants.ts";
// @ts-types="npm:@types/less";
import less from "less";
async function compile(source: string) {
const result = await less.render(
`
@import "lib/lib.less";
${source}
`,
{ paths: [REPO_ROOT] },
);
return result.css;
}
Deno.test("#lib.rgbify", async (ctx) => {
await assertSnapshot(
ctx,
await compile(`
.foo {
--bar: #lib.rgbify(red)[];
}
`),
);
});
Deno.test("#lib.hslify", async (ctx) => {
await assertSnapshot(
ctx,
await compile(`
.foo {
--bar: #lib.hslify(red)[];
}
`),
);
});