Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2
3import { applyCommandOutputFrame, EMPTY_COMMAND_OUTPUT } from "./commandOutput.ts";
4
5describe("applyCommandOutputFrame", () => {
6 it("continues an escape and a redraw split across appends", () => {
7 let view = applyCommandOutputFrame(EMPTY_COMMAND_OUTPUT, {
8 kind: "replace",
9 text: "install\n12%\u001b[3",
10 truncated: false,
11 running: true,
12 });
13 expect(view.output.text).toBe("install\n12%");
14 view = applyCommandOutputFrame(view, {
15 kind: "append",
16 text: "2m\r100%\u001b[0m\n",
17 truncated: false,
18 running: true,
19 });
20 // The colour opened before the redraw survives it.
21 expect(view.output.text).toBe("install\n\u001b[0;32m100%\u001b[0m\n");
22 expect(view.running).toBe(true);
23 });
24});