Skip to content

Commit 84f9b52

Browse files
committed
chore: fix teardownCore with aggregate
1 parent 2e1c827 commit 84f9b52

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/core/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ export const setupCore = () => {
2121
mongoMeasurement = new MongoMeasurement();
2222
};
2323

24-
export const teardownCore = () => {
24+
export const teardownCore = async () => {
2525
linuxPerf.stop();
26-
const aggregate = mongoMeasurement.terminate();
26+
const aggregate = await mongoMeasurement.terminate();
2727
if (aggregate !== undefined) {
2828
console.log(`[CodSpeed] Mongo Aggregate: ${aggregate}`);
29-
return;
29+
return aggregate;
3030
}
3131
console.log(`[CodSpeed] Mongo Aggregate: no aggregate`);
3232
};

packages/tinybench-plugin/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ export function withCodSpeed(bench: Bench): Bench {
8282
// print results
8383
console.log(` ✔ Measured ${uri}`);
8484
}
85-
teardownCore();
85+
const aggregate = await teardownCore();
86+
console.log(
87+
`[CodSpeed] Mongo Aggregate: ${JSON.stringify(aggregate, null, 2)}`
88+
);
8689
console.log(`[CodSpeed] Done running ${bench.tasks.length} benches.`);
8790
return bench.tasks;
8891
};

0 commit comments

Comments
 (0)