From 54e2890b300f2935db592edd7d01fc38c3198ffc Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sun, 11 Oct 2026 06:29:26 +0800 Subject: [PATCH] fix(ci): check decoded reference paths and restore formatting (#1648) * style(browser): format cached SVG ancestry check * fix(tests): assert decoded reference-source error paths --- src/browser/CdpCaptureDocuments.ts | 3 +-- .../cli/referenceSourceImportStatus.test.ts | 23 ++++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/browser/CdpCaptureDocuments.ts b/src/browser/CdpCaptureDocuments.ts index 38e3475f7a..bccc08447e 100644 --- a/src/browser/CdpCaptureDocuments.ts +++ b/src/browser/CdpCaptureDocuments.ts @@ -412,8 +412,7 @@ const elementInSvgContext = ( } const parent = Math.trunc(parents[current] ?? -1); if (parent < 0 || parent === current) break; - if (indexedString(strings, nodeNames[parent]) === "foreignObject") - break; + if (indexedString(strings, nodeNames[parent]) === "foreignObject") break; current = parent; } // Cache the entire examined chain, including forward references and cycles, diff --git a/tests/boundary/cli/referenceSourceImportStatus.test.ts b/tests/boundary/cli/referenceSourceImportStatus.test.ts index 4c971899cf..9e6de7e43c 100644 --- a/tests/boundary/cli/referenceSourceImportStatus.test.ts +++ b/tests/boundary/cli/referenceSourceImportStatus.test.ts @@ -118,10 +118,17 @@ describe("compiled reference-source import preflight failures", () => { } else { expect(result.json).toMatchObject(invalidRootOutput); } - expect(JSON.stringify(result.json)).toContain( - "Check that the path exists, is readable, and points to a directory.", + const messagePath = scenario.fullOutput ? "data.message" : "message"; + expect(result.json).toHaveProperty( + messagePath, + expect.stringContaining( + "Check that the path exists, is readable, and points to a directory.", + ), + ); + expect(result.json).toHaveProperty( + messagePath, + expect.stringContaining(root), ); - expect(JSON.stringify(result.json)).toContain(root); expect.soft(result.exitCode).toBe(1); if (scenario.logging) { const records: unknown[] = result.stderr @@ -169,9 +176,13 @@ describe("compiled reference-source import preflight failures", () => { category: "execution_failure", message: expect.stringContaining("EACCES: permission denied"), }); - expect(JSON.stringify(result.json)).toContain(root); - expect(JSON.stringify(result.json)).toContain( - "Check directory permissions and try again.", + expect(result.json).toHaveProperty( + "message", + expect.stringContaining(root), + ); + expect(result.json).toHaveProperty( + "message", + expect.stringContaining("Check directory permissions and try again."), ); expect(result.exitCode).toBe(1); } finally {