Skip to content

Commit

Permalink
bench: no longer executes files that do not export a main function, a…
Browse files Browse the repository at this point in the history
…nd also force removes the metrics file if it does not exist
  • Loading branch information
CMCDragonkai committed Oct 4, 2023
1 parent 7d7bc59 commit 69b046b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions benches/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ async function main(): Promise<void> {
continue;
}
const suite: () => Promise<Summary> = (await import(suitePath)).default;
await suite();
// Skip default exports that are not functions and are not called "main"
// They might be utility files
if (typeof suite === 'function' && suite.name === 'main') {
await suite();
}
}
// Concatenating metrics
const metricsPath = path.join(resultsPath, 'metrics.txt');
await fs.promises.rm(metricsPath);
await fs.promises.rm(metricsPath, { force: true });
let concatenating = false;
for await (const metricPath of fsWalk(resultsPath)) {
// Skip over non-metrics files
Expand Down

0 comments on commit 69b046b

Please sign in to comment.