Skip to content

Commit b200f1d

Browse files
committed
small leak in array test
1 parent afcc464 commit b200f1d

File tree

7 files changed

+44
-0
lines changed

7 files changed

+44
-0
lines changed

internal/perf/tests/heapsnapshot.test.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,50 @@ it.skipIf(
6464
},
6565
);
6666

67+
it.skipIf(
68+
// no need to test in bun (also, bun does not support increasing timeouts per test)
69+
globalThis.Bun,
70+
)(
71+
'should detect a small leak in a forver growing array',
72+
{
73+
// parsing snapshots can take a while, so we increase the timeout
74+
timeout: 30_000,
75+
},
76+
async () => {
77+
await using snaps = await archivedFixtureFiles([
78+
'small-leak-in-growing-array/1.heapsnapshot',
79+
'small-leak-in-growing-array/2.heapsnapshot',
80+
'small-leak-in-growing-array/3.heapsnapshot',
81+
'small-leak-in-growing-array/4.heapsnapshot',
82+
'small-leak-in-growing-array/5.heapsnapshot',
83+
'small-leak-in-growing-array/6.heapsnapshot',
84+
]);
85+
await expect(leakingObjectsInHeapSnapshotFiles(snaps.filepaths)).resolves
86+
.toMatchInlineSnapshot(`
87+
{
88+
"(system)": {
89+
"addedCount": 47,
90+
"addedSize": 88040,
91+
"countDelta": -50,
92+
"name": "(system)",
93+
"removedCount": 97,
94+
"removedSize": 38408,
95+
"sizeDelta": 49632,
96+
},
97+
"{subgraphName}": {
98+
"addedCount": 60597,
99+
"addedSize": 1939104,
100+
"countDelta": 60597,
101+
"name": "{subgraphName}",
102+
"removedCount": 0,
103+
"removedSize": 0,
104+
"sizeDelta": 1939104,
105+
},
106+
}
107+
`);
108+
},
109+
);
110+
67111
/**
68112
* Unarchives the {@link archivedFiles provided fixture files} for using in
69113
* tests and then removes them on disposal.

0 commit comments

Comments
 (0)