### Install ansivision via npm Source: https://github.com/43081j/ansivision/blob/main/README.md Installs the ansivision package, which renders ANSI terminal output into visual frames for testing or visualization purposes. ```bash npm install ansivision ``` -------------------------------- ### Render ANSI string with renderString in TypeScript Source: https://github.com/43081j/ansivision/blob/main/README.md Uses the renderString function to convert an ANSI-encoded string into an async iterable of rendered frames. In the example, a red-colored "Hello" produces a single frame displaying "Hello World". ```ts import { renderString } from "ansivision"; const input = "\x1b[31mHello\x1b[0m World"; const rendered = await renderString(input); for (const frame of rendered) { // will render frame 1 which is "Hello World" console.log(frame); } ``` -------------------------------- ### Snapshot-test CLI output with renderStringToFrames and vitest Source: https://github.com/43081j/ansivision/blob/main/README.md Shows how to assert rendered ANSI output in a vitest test. It runs a CLI command with tinyexec, passes the stdout to renderStringToFrames, and compares the frames to a snapshot. Note that you may need FORCE_COLOR=true because many CLIs disable ANSI codes when non-interactive. ```ts import { test, expect } from "vitest"; import { renderStringToFrames } from "ansivision"; import { x } from "tinyexec"; test("renders expected output", async () => { const result = await x('my-command', []); const frames = await renderStringToFrames(result.stdout); expect(frames).toMatchSnapshot(); }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.