@heyhuynhgiabuu/pi-pretty 0.3.3 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -370,11 +370,20 @@ describe("piPrettyExtension integration", () => {
370
370
  expect(grep).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({ mode: "regex" }));
371
371
  });
372
372
 
373
- it("glob prepended to query", async () => {
373
+ it("glob constraints bypass FFF to avoid native Unicode path panic", async () => {
374
374
  const grep = vi.fn().mockReturnValue({ ok: true, value: { items: [], totalMatched: 0, nextCursor: null } });
375
375
  await loadWithFFF({ grep });
376
376
  await tools.get("grep")!.execute("t1", { pattern: "TODO", glob: "*.ts" }, null, null, {});
377
- expect(grep).toHaveBeenCalledWith("*.ts TODO", expect.any(Object));
377
+ expect(grep).not.toHaveBeenCalled();
378
+ expect(grepExec).toHaveBeenCalledOnce();
379
+ });
380
+
381
+ it("path constraints bypass FFF to avoid native Unicode path panic", async () => {
382
+ const grep = vi.fn().mockReturnValue({ ok: true, value: { items: [], totalMatched: 0, nextCursor: null } });
383
+ await loadWithFFF({ grep });
384
+ await tools.get("grep")!.execute("t1", { pattern: "TODO", path: "file_reviewapp/static/app.js" }, null, null, {});
385
+ expect(grep).not.toHaveBeenCalled();
386
+ expect(grepExec).toHaveBeenCalledOnce();
378
387
  });
379
388
 
380
389
  it("falls back to SDK on throw", async () => {
@@ -1,3 +1,5 @@
1
+ import { mkdirSync, rmSync } from "node:fs";
2
+
1
3
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
2
4
 
3
5
  import piPrettyExtension, { __imageInternals } from "../src/index.js";
@@ -63,8 +65,11 @@ function loadReadTool(readExec: any) {
63
65
 
64
66
  describe("image rendering terminal detection", () => {
65
67
  const envSnapshot = new Map<string, string | undefined>();
68
+ const agentDir = "/tmp/pi-pretty-test";
66
69
 
67
70
  beforeEach(() => {
71
+ rmSync(agentDir, { recursive: true, force: true });
72
+ mkdirSync(agentDir, { recursive: true });
68
73
  for (const key of ENV_KEYS) {
69
74
  envSnapshot.set(key, process.env[key]);
70
75
  delete process.env[key];
@@ -73,6 +78,7 @@ describe("image rendering terminal detection", () => {
73
78
  });
74
79
 
75
80
  afterEach(() => {
81
+ rmSync(agentDir, { recursive: true, force: true });
76
82
  for (const key of ENV_KEYS) {
77
83
  const value = envSnapshot.get(key);
78
84
  if (value === undefined) delete process.env[key];