diff --git a/memory-leaks/tests/cell.test.mjs b/memory-leaks/tests/cell.test.mjs index e1dfb80a..04545775 100644 --- a/memory-leaks/tests/cell.test.mjs +++ b/memory-leaks/tests/cell.test.mjs @@ -7,11 +7,11 @@ describe("# Cell memory leaks", () => { await testScenario(addScenario, { expectations: [ // Code cell - { objects: 980, collections: 18 }, + { leak: true, objects: 980, collections: 18 }, // Markdown cell - { objects: 656, collections: 28 }, + { leak: true, objects: 656, collections: 28 }, // Raw cell - { objects: 548, collections: 28 }, + { leak: true, objects: 548, collections: 28 }, ], }); }); diff --git a/memory-leaks/tests/notebook.test.mjs b/memory-leaks/tests/notebook.test.mjs index d849912d..87f13350 100644 --- a/memory-leaks/tests/notebook.test.mjs +++ b/memory-leaks/tests/notebook.test.mjs @@ -4,7 +4,7 @@ import * as notebookScenario from "./notebook.mjs"; describe("# Notebook memory leaks", () => { it("Opening a notebook", async () => { await testScenario(notebookScenario, { - expectations: [{ collections: 8, objects: 463 }], + expectations: [{ leak: true, collections: 8, objects: 463 }], }); }); }); diff --git a/memory-leaks/tests/utils.mjs b/memory-leaks/tests/utils.mjs index 1c8a2b86..1ec32097 100644 --- a/memory-leaks/tests/utils.mjs +++ b/memory-leaks/tests/utils.mjs @@ -25,12 +25,13 @@ function expectNoLeaks(results, defaultValues = []) { console.log(formatResultAsMarkdown(test)); }); - expect( - results.map((test) => test.result.leaks.detected).includes(true) - ).to.equal(false); - results.forEach((test, idx) => { const expectations = defaultValues[idx] ?? {}; + + expect( + test.result.leaks.detected + ).to.equal(expectations.leak ?? false); + expect( test.result.leaks.objects .map((obj) => obj.countDeltaPerIteration)