Skip to content

Commit 69b046b

Browse files
committed
bench: no longer executes files that do not export a main function, and also force removes the metrics file if it does not exist
1 parent 7d7bc59 commit 69b046b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

benches/index.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ async function main(): Promise<void> {
1616
continue;
1717
}
1818
const suite: () => Promise<Summary> = (await import(suitePath)).default;
19-
await suite();
19+
// Skip default exports that are not functions and are not called "main"
20+
// They might be utility files
21+
if (typeof suite === 'function' && suite.name === 'main') {
22+
await suite();
23+
}
2024
}
2125
// Concatenating metrics
2226
const metricsPath = path.join(resultsPath, 'metrics.txt');
23-
await fs.promises.rm(metricsPath);
27+
await fs.promises.rm(metricsPath, { force: true });
2428
let concatenating = false;
2529
for await (const metricPath of fsWalk(resultsPath)) {
2630
// Skip over non-metrics files

0 commit comments

Comments
 (0)