mirror of
https://github.com/morluto/rea.git
synced 2026-11-09 08:17:02 +00:00
fix(web): select source grammar for module tracing
This commit is contained in:
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" },
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user