Skip to content

Commit

Permalink
Fix expectations (#135)
Browse files Browse the repository at this point in the history
* Fix expectations

* Update md cell expectation

* Improve robustness

* Adjust expectations
  • Loading branch information
fcollonval committed Feb 13, 2023
1 parent 86c34a5 commit 4078882
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions memory-leaks/tests/cell.test.mjs
Expand Up @@ -7,11 +7,11 @@ describe("# Cell memory leaks", () => {
await testScenario(addScenario, {
expectations: [
// Code cell
{ leak: true, objects: 980, collections: 18 },
{ leak: true, objects: 1283, collections: 18 },
// Markdown cell
{ leak: true, objects: 656, collections: 28 },
{ leak: null, objects: 867, collections: 28 },
// Raw cell
{ leak: true, objects: 548, collections: 28 },
{ leak: true, objects: 673, collections: 28 },
],
});
});
Expand Down
2 changes: 1 addition & 1 deletion memory-leaks/tests/notebook.test.mjs
Expand Up @@ -4,7 +4,7 @@ import * as notebookScenario from "./notebook.mjs";
describe("# Notebook memory leaks", () => {
it("Opening a notebook", async () => {
await testScenario(notebookScenario, {
expectations: [{ leak: true, collections: 8, objects: 463 }],
expectations: [{ leak: true, collections: 8, objects: 630 }],
});
});
});
9 changes: 6 additions & 3 deletions memory-leaks/tests/utils.mjs
Expand Up @@ -28,9 +28,12 @@ function expectNoLeaks(results, defaultValues = []) {
results.forEach((test, idx) => {
const expectations = defaultValues[idx] ?? {};

expect(
test.result.leaks.detected
).to.equal(expectations.leak ?? false);
// If expectations.leak is `null`, don't test for it - flakyness
if (['boolean', 'undefined'].includes(typeof expectations.leak)) {
expect(
test.result.leaks.detected
).to.equal(expectations.leak ?? false);
}

expect(
test.result.leaks.objects
Expand Down

0 comments on commit 4078882

Please sign in to comment.