Add CI workflow and fix workspace tests

This commit is contained in:
Peter Steinberger 2025-12-02 12:12:17 +00:00
parent 30f69c5f83
commit c43f1d307c
11 changed files with 192 additions and 51 deletions

View file

@ -1,9 +1,12 @@
import assert from "node:assert";
import { describe, it } from "node:test";
import chalk from "chalk";
import { Chalk } from "chalk";
import { Markdown } from "../src/components/markdown.js";
import { defaultMarkdownTheme } from "./test-themes.js";
// Force full color in CI so ANSI assertions are deterministic
const chalk = new Chalk({ level: 3 });
describe("Markdown component", () => {
describe("Nested lists", () => {
it("should render simple nested list", () => {
@ -218,9 +221,9 @@ describe("Markdown component", () => {
assert.ok(joinedOutput.includes("\x1b[90m"), "Should have gray color code");
assert.ok(joinedOutput.includes("\x1b[3m"), "Should have italic code");
// Verify that after the inline code (cyan text), we reapply gray italic
const hasCyan = joinedOutput.includes("\x1b[36m"); // cyan
assert.ok(hasCyan, "Should have cyan for inline code");
// Verify that inline code is styled (theme uses yellow)
const hasCodeColor = joinedOutput.includes("\x1b[33m");
assert.ok(hasCodeColor, "Should style inline code");
});
it("should preserve gray italic styling after bold text", () => {

View file

@ -2,9 +2,11 @@
* Default themes for TUI tests using chalk
*/
import chalk from "chalk";
import { Chalk } from "chalk";
import type { EditorTheme, MarkdownTheme, SelectListTheme } from "../src/index.js";
const chalk = new Chalk({ level: 3 });
export const defaultSelectListTheme: SelectListTheme = {
selectedPrefix: (text: string) => chalk.blue(text),
selectedText: (text: string) => chalk.bold(text),

View file

@ -1,9 +1,12 @@
import assert from "node:assert";
import { describe, it } from "node:test";
import chalk from "chalk";
import { Chalk } from "chalk";
import { TruncatedText } from "../src/components/truncated-text.js";
import { visibleWidth } from "../src/utils.js";
// Force full color in CI so ANSI assertions are deterministic
const chalk = new Chalk({ level: 3 });
describe("TruncatedText component", () => {
it("pads output lines to exactly match width", () => {
const text = new TruncatedText("Hello world", 1, 0);