fix(status): full-width tables + better diagnosis

This commit is contained in:
Peter Steinberger
2026-01-11 00:54:19 +01:00
parent f3882671c9
commit 5fa3ac1e01
9 changed files with 1063 additions and 885 deletions

View File

@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
import { visibleWidth } from "./ansi.js";
import { renderTable } from "./table.js";
describe("renderTable", () => {
@@ -16,4 +17,19 @@ describe("renderTable", () => {
expect(out).toContain("Dashboard");
expect(out).toMatch(/│ Dashboard\s+│/);
});
it("expands flex columns to fill available width", () => {
const width = 60;
const out = renderTable({
width,
columns: [
{ key: "Item", header: "Item", minWidth: 10 },
{ key: "Value", header: "Value", flex: true, minWidth: 24 },
],
rows: [{ Item: "OS", Value: "macos 26.2 (arm64)" }],
});
const firstLine = out.trimEnd().split("\n")[0] ?? "";
expect(visibleWidth(firstLine)).toBe(width);
});
});