fix(web): select source grammar for module tracing

This commit is contained in:
morluto committed 2026-10-24 02:35:36 +08:00
1 parent 38ecc0248e
commit 9974512600
5 files changed
+53 -6

No files matched your search

@@ -369,3 +369,26 @@ it("retains a completed engine-free trace when artifact loading finishes under c
},
});
});
it("resolves imports from relational JavaScript using the selected source grammar", async () => {
const artifacts = webModuleArtifactsFixture(
'const order = left < import("./dep.js") > (right);',
);
const result = await new WebModuleTraceService(
{ load: async () => ok(artifacts) },
webModuleResolverFixture,
).trace(args);
if (!result.ok) throw result.error;
expect(
webModuleTraceResultSchema.parse(result.value.normalized_result),
).toMatchObject({
parser: { state: "parsed", diagnostics: [] },
imports: [
{
kind: "dynamic-import",
specifier: "./dep.js",
resolution: { state: "resolved", url: "https://app.test/dep.js" },
},
],
});
});