Skip to content

Commit 0f06dc1

Browse files
committed
chore: fix teardownCore with aggregate
1 parent f585981 commit 0f06dc1

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
@@ -22,12 +22,12 @@ export const setupCore = () => {
2222
mongoMeasurement = new MongoMeasurement();
2323
};
2424

25-
export const teardownCore = () => {
25+
export const teardownCore = async () => {
2626
linuxPerf.stop();
27-
const aggregate = mongoMeasurement.terminate();
27+
const aggregate = await mongoMeasurement.terminate();
2828
if (aggregate !== undefined) {
2929
console.log(`[CodSpeed] Mongo Aggregate: ${aggregate}`);
30-
return;
30+
return aggregate;
3131
}
3232
console.log(`[CodSpeed] Mongo Aggregate: no aggregate`);
3333
};

packages/tinybench-plugin/src/index.ts

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

0 commit comments

Comments
 (0)