diff --git a/packages/app/src/terminal/local-links/terminal-local-link-parsing.test.ts b/packages/app/src/terminal/local-links/terminal-local-link-parsing.test.ts index 0dcf1e311e..9ef29d80a1 100644 --- a/packages/app/src/terminal/local-links/terminal-local-link-parsing.test.ts +++ b/packages/app/src/terminal/local-links/terminal-local-link-parsing.test.ts @@ -2,6 +2,23 @@ import { describe, expect, it } from "vitest"; import { detectTerminalLocalLinks } from "./terminal-local-link-parsing"; describe("detectTerminalLocalLinks", () => { + it.each([ + ["user@host:~/projects$ ls", 10, "~/projects"], + ["root@host:/etc/nginx# ", 10, "/etc/nginx"], + ["user@host ~/src% ", 10, "~/src"], + ])("excludes the prompt marker in %s", (line, index, text) => { + expect(detectTerminalLocalLinks(line)).toMatchObject([ + { path: { index, text }, suffix: undefined }, + ]); + }); + + it.each(["$", "#", "%"])("preserves a filename ending in %s", (marker) => { + const path = `/tmp/report${marker}`; + expect(detectTerminalLocalLinks(`cat ${path}`)).toMatchObject([ + { path: { index: 4, text: path }, suffix: undefined }, + ]); + }); + it("detects VS Code-style filename and line suffixes", () => { expect(detectTerminalLocalLinks("file.ts:42")).toMatchObject([ {