Skip to content

Commit

Permalink
Run the data function as soon as evalite is called for maximum concur…
Browse files Browse the repository at this point in the history
…rency.
  • Loading branch information
mattpocock committed Dec 17, 2024
1 parent 3b00a21 commit f26eaaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-pants-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"evalite": patch
---

Run the data function as soon as evalite is called for maximum concurrency.
8 changes: 5 additions & 3 deletions packages/evalite/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ export const evalite = <TInput, TExpected = TInput>(
evalName: string,
opts: Evalite.RunnerOpts<TInput, TExpected>
) => {
return describe.concurrent(evalName, async () => {
const dataset = await opts.data();

// Eagerly run the promise before the dataset for
// maximum concurrency
const datasetPromise = opts.data();
return describe(evalName, async () => {
const dataset = await datasetPromise;
it.concurrent.for(dataset.map((d, index) => ({ ...d, index })))(
evalName,
async (data, { task }) => {
Expand Down

0 comments on commit f26eaaa

Please sign in to comment.