Skip to content

Commit d45c83c

Browse files
committed
fix(tests): update runMemoryTest to support asynchronous test functions
1 parent 05b379b commit d45c83c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/memory.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describeMemoryTests("Memory Tests", () => {
2727

2828
function runMemoryTest(
2929
testName: string,
30-
testFn: () => void,
30+
testFn: () => void | Promise<void>,
3131
options: {
3232
iterations?: number;
3333
warmupIterations?: number;
@@ -42,20 +42,20 @@ describeMemoryTests("Memory Tests", () => {
4242
errorMargin = 0.1,
4343
} = options;
4444

45-
test(testName, () => {
45+
test(testName, async () => {
4646
const measurements: number[] = [];
4747

4848
// Warm up
4949
for (let i = 0; i < warmupIterations; i++) {
50-
testFn();
50+
await testFn();
5151
if (gc) gc();
5252
}
5353

5454
// Take measurements
5555
for (let i = 0; i < iterations; i++) {
5656
// run gc() before each measurement:
5757
getMemoryUsage();
58-
testFn();
58+
await testFn();
5959
const after = getMemoryUsage();
6060
measurements.push(after);
6161

0 commit comments

Comments
 (0)