chore(deps): Kill small dependencies (#4467)

This commit is contained in:
Armin Ronacher
2026-05-13 10:44:56 +02:00
committed by GitHub
parent 8da1f3d131
commit 2829146dde
18 changed files with 357 additions and 227 deletions

View File

@@ -0,0 +1,22 @@
import { describe, expect, it } from "vitest";
import { stripAnsi } from "../src/utils/ansi.js";
describe("stripAnsi", () => {
it("strips RIS without leaking the final byte", () => {
expect(stripAnsi("\x1bcdone")).toBe("done");
});
it("strips single-byte ESC sequences without leaking final bytes", () => {
for (let code = "g".charCodeAt(0); code <= "m".charCodeAt(0); code++) {
expect(stripAnsi(`\x1b${String.fromCharCode(code)}ok`)).toBe("ok");
}
for (let code = "r".charCodeAt(0); code <= "t".charCodeAt(0); code++) {
expect(stripAnsi(`\x1b${String.fromCharCode(code)}ok`)).toBe("ok");
}
});
it("strips common ANSI sequences used in tool output", () => {
const input = "a\x1b[31mred\x1b[0m\x1b]8;;https://example.com\x07link\x1b]8;;\x07z";
expect(stripAnsi(input)).toBe("aredlinkz");
});
});