mirror of
https://github.com/morluto/rea.git
synced 2026-11-10 16:57:19 +00:00
fix(javascript): bound primitive string growth and repeated evaluation
This commit is contained in:
1 parent
770d2f60aa
commit
4a1837d9d5
10 files changed
+298
-25
No files matched your search
@@ -114,6 +114,15 @@ it("reports semantic value resource limits in application graph coverage", async
|
||||
join(root, "app.js"),
|
||||
`const answer = { nested: ${expression} };`,
|
||||
);
|
||||
const declarations = ['const value0 = "x";'];
|
||||
for (let index = 1; index <= 30; index += 1) {
|
||||
const previous = `value${String(index - 1)}`;
|
||||
declarations.push(
|
||||
`const value${String(index)} = ${previous} + ${previous};`,
|
||||
);
|
||||
}
|
||||
declarations.push("const answer = value30;");
|
||||
await writeFile(join(root, "growth.js"), declarations.join("\n"));
|
||||
const snapshot = await scanCanonicalArtifactInventory(root, {});
|
||||
const reader = createJavaScriptArtifactReader(root, "directory");
|
||||
try {
|
||||
@@ -124,17 +133,25 @@ it("reports semantic value resource limits in application graph coverage", async
|
||||
expect(graph.coverage).toMatchObject({
|
||||
status: "partial",
|
||||
omitted_count: null,
|
||||
limits: [
|
||||
{
|
||||
limits: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
name: "javascript_semantic_primitive_candidates",
|
||||
value: 256,
|
||||
unit: "items",
|
||||
},
|
||||
],
|
||||
}),
|
||||
expect.objectContaining({
|
||||
name: "javascript_semantic_primitive_bytes",
|
||||
unit: "bytes",
|
||||
}),
|
||||
]),
|
||||
});
|
||||
expect(graph.limitations).toContain(
|
||||
"Primitive candidate budget exceeded (maximum 256 alternatives).",
|
||||
);
|
||||
expect(graph.limitations).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.stringMatching(/primitive string-byte budget exceeded/i),
|
||||
]),
|
||||
);
|
||||
} finally {
|
||||
await reader.close();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user