Merges two features: FN-3039 bundles a 2.5MB Nerd Font glyph asset into the dashboard and updates the terminal to prioritize the bundled font, improving icon rendering across environments; FN-3035 tightens insight tool type definitions and adds corresponding tests. The CLI extension gains new tools Fusion-Task-Id: FN-3039
48 lines
1.9 KiB
TypeScript
48 lines
1.9 KiB
TypeScript
import { readdirSync, readFileSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
import { beforeAll, describe, expect, test } from "vitest";
|
|
import {
|
|
dashboardClientAssetsDir,
|
|
dashboardClientDistDir,
|
|
ensureDashboardClientBuild,
|
|
} from "./build-output-setup";
|
|
|
|
describe("mobile build output chunking", () => {
|
|
beforeAll(() => {
|
|
// Clean worktrees and CI often start without dist/client; build explicitly so
|
|
// chunking assertions always execute instead of being gated by ambient artifacts.
|
|
ensureDashboardClientBuild();
|
|
}, 180_000);
|
|
|
|
test("creates vendor chunk files for core dependencies", () => {
|
|
const files = readdirSync(dashboardClientAssetsDir);
|
|
const jsFiles = files.filter((file) => file.endsWith(".js"));
|
|
|
|
expect(jsFiles.length).toBeGreaterThan(2);
|
|
expect(jsFiles.some((file) => /^vendor-react-[A-Za-z0-9_-]+\.js$/.test(file))).toBe(true);
|
|
expect(jsFiles.some((file) => /^vendor-xterm-[A-Za-z0-9_-]+\.js$/.test(file))).toBe(true);
|
|
});
|
|
|
|
test("index.html references chunked asset scripts", () => {
|
|
const indexHtml = readFileSync(resolve(dashboardClientDistDir, "index.html"), "utf8");
|
|
|
|
expect(indexHtml).toContain("<script");
|
|
expect(indexHtml).toMatch(/assets\/.+-[A-Za-z0-9_-]+\.js/);
|
|
expect(indexHtml).toMatch(/assets\/vendor-react-[A-Za-z0-9_-]+\.js/);
|
|
expect(indexHtml).toMatch(/assets\/vendor-xterm-[A-Za-z0-9_-]+\.js/);
|
|
});
|
|
|
|
test("ships Nerd Font symbol fallback asset and preloads it in dist index", () => {
|
|
const bundledFontPath = resolve(
|
|
dashboardClientDistDir,
|
|
"fonts",
|
|
"SymbolsNerdFontMono-Regular.ttf",
|
|
);
|
|
const indexHtml = readFileSync(resolve(dashboardClientDistDir, "index.html"), "utf8");
|
|
|
|
expect(() => readFileSync(bundledFontPath)).not.toThrow();
|
|
expect(indexHtml).toContain('/fonts/SymbolsNerdFontMono-Regular.ttf');
|
|
expect(indexHtml).toContain('rel="preload"');
|
|
});
|
|
});
|