From 110932cd5e6721735f5cdef125e6f2f61a313f8f Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:08:18 +0800 Subject: [PATCH] test: clarify source map and worker diagnostics --- src/domain/sourceMapEnvelope.test.ts | 4 ++-- .../analysis/JavaScriptAnalysisWorkerServer.test.ts | 4 ++-- src/javascript/sourceMaps/TraceSourceMap.test.ts | 5 ++--- .../javascriptApplicationSourceMapMappings.test.ts | 10 +++++++--- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/domain/sourceMapEnvelope.test.ts b/src/domain/sourceMapEnvelope.test.ts index eca6a3aeff..eaa3649738 100644 --- a/src/domain/sourceMapEnvelope.test.ts +++ b/src/domain/sourceMapEnvelope.test.ts @@ -109,7 +109,7 @@ describe("source-map envelope walk", () => { invalid_sections: [ { section_path: [2], - reason: "External source-map section URL must be a string.", + reason: expect.stringMatching(/section URL.*must be a string/iu), }, ], }); @@ -149,7 +149,7 @@ describe("malformed source-map envelope facts", () => { invalid_sections: [ { section_path: [], - reason: "Indexed source-map sections must be an array.", + reason: expect.stringMatching(/sections.*must be an array/iu), }, ], }); diff --git a/src/javascript/analysis/JavaScriptAnalysisWorkerServer.test.ts b/src/javascript/analysis/JavaScriptAnalysisWorkerServer.test.ts index 5e9d968ff4..270a9bbf93 100644 --- a/src/javascript/analysis/JavaScriptAnalysisWorkerServer.test.ts +++ b/src/javascript/analysis/JavaScriptAnalysisWorkerServer.test.ts @@ -159,7 +159,7 @@ it("drains oversized checkpoint admission, reports output failure, and serves th reason: "output", resource: null, limits: null, - message: "JavaScript worker admission frame is missing or oversized", + message: expect.stringMatching(/admission frame.*missing or oversized/iu), }); expect(await server.next()).toMatchObject({ kind: "static", @@ -198,7 +198,7 @@ it("reports missing checkpoint admission as output failure at stdin EOF", async id: request.id, reason: "output", resource: null, - message: "JavaScript worker admission frame is missing or oversized", + message: expect.stringMatching(/admission frame.*missing or oversized/iu), }); expect((await server.closed)[0]).toBe(0); } finally { diff --git a/src/javascript/sourceMaps/TraceSourceMap.test.ts b/src/javascript/sourceMaps/TraceSourceMap.test.ts index 03f1a8bb7c..f6b006516e 100644 --- a/src/javascript/sourceMaps/TraceSourceMap.test.ts +++ b/src/javascript/sourceMaps/TraceSourceMap.test.ts @@ -63,8 +63,7 @@ it("uses the same conservative section classification for URL-plus-map and malfo expect(malformed).toThrow( expect.objectContaining({ reason: "format", - message: - "External source-map section URL must be a string. Section path: [0].", + message: expect.stringMatching(/section URL.*must be a string.*\[0\]/iu), }), ); }); @@ -82,7 +81,7 @@ it("rejects a present non-array sections member through the shared section-list expect(malformed).toThrow( expect.objectContaining({ reason: "format", - message: "Indexed source-map sections must be an array.", + message: expect.stringMatching(/sections.*must be an array/iu), }), ); }); diff --git a/tests/boundary/filesystem/javascript-applications/javascriptApplicationSourceMapMappings.test.ts b/tests/boundary/filesystem/javascript-applications/javascriptApplicationSourceMapMappings.test.ts index dea95dc837..fadc5882aa 100644 --- a/tests/boundary/filesystem/javascript-applications/javascriptApplicationSourceMapMappings.test.ts +++ b/tests/boundary/filesystem/javascript-applications/javascriptApplicationSourceMapMappings.test.ts @@ -260,7 +260,9 @@ it("keeps external indexed sections unsupported while retaining local siblings", invalid_sections: [ { section_path: [2], - reason: "External source-map section URL must be a string.", + reason: expect.stringMatching( + /section URL.*must be a string/iu, + ), }, ], }), @@ -313,14 +315,16 @@ it("marks non-array sections malformed even when the object has regular-map fiel invalid_sections: [ { section_path: [], - reason: "Indexed source-map sections must be an array.", + reason: expect.stringMatching(/sections.*must be an array/iu), }, ], }), evidence: expect.objectContaining({ artifact: expect.objectContaining({ sha256: digest }), limitations: [ - "Indexed source-map section at []: Indexed source-map sections must be an array.", + expect.stringMatching( + /section at \[\].*sections.*must be an array/iu, + ), ], }), }),