Notes/packages/highlightjs/src/syntax_highlighting.spec.ts

21 lines
599 B
TypeScript
Raw Normal View History

2025-05-18 11:26:59 +03:00
import { describe, it } from "vitest";
import definitions from "./syntax_highlighting.js";
import hljs from "highlight.js";
2025-05-18 11:26:59 +03:00
describe("Syntax highlighting definitions", () => {
it("every entry is readable", async () => {
for (const [ mime, mapping ] of Object.entries(definitions)) {
if (mapping === null) {
continue;
}
const language = (await mapping.loader).default;
hljs.registerLanguage(mime, language);
hljs.highlight("Hello world", {
language: mime
});
2025-05-18 11:26:59 +03:00
}
});
});