@@ -16,6 +16,7 @@ import {
1616import { createRequire } from "module" ;
1717import path from "path" ;
1818import type {
19+ BenchFnOptions ,
1920 BenchmarkGroup ,
2021 BenchmarkProvider ,
2122 BenchRegistrationInput ,
@@ -24,7 +25,7 @@ import type {
2425} from "vitest" ;
2526import {
2627 installInstrumentHooks ,
27- setForkedBenchmarks ,
28+ queueForkedBenchmarks ,
2829 tinybenchTaskToBenchmark ,
2930 writeAndLogWalltimeResults ,
3031 type TinybenchBench ,
@@ -257,8 +258,10 @@ async function runWalltime(
257258
258259 throwOnErroredTasks ( tasks ) ;
259260 if ( mode . kind === "Fork" ) {
261+ // A task that didn't complete fails the test below, like without forks.
260262 for ( const task of tasks ) {
261- writeForkSamples ( mode . samplesFile , task . result ?. latency . samples ?? [ ] ) ;
263+ if ( task . result ?. state !== "completed" ) continue ;
264+ writeForkSamples ( mode . samplesFile , task . result . latency . samples ?? [ ] ) ;
262265 }
263266 } else {
264267 collectWalltimeResults ( bench , getUri ) ;
@@ -285,13 +288,13 @@ async function queueForks(
285288 const { Bench } = await importHostTinybench ( ) ;
286289 // Never run: it resolves tinybench's defaults for the reported config.
287290 const bench = new Bench ( options ) ;
288- setForkedBenchmarks (
291+ queueForkedBenchmarks (
289292 test . meta ,
290293 registrations . map ( ( { name, fnOpts } ) => ( {
291294 uri : getUri ( name ) ,
292295 name,
293296 forks :
294- ( fnOpts as WalltimeOptions | undefined ) ?. forks ??
297+ ( fnOpts as BenchFnOptions | undefined ) ?. forks ??
295298 ( options as WalltimeOptions | undefined ) ?. forks ,
296299 options : resolvedOptions ( bench ) ,
297300 } ) ) ,
0 commit comments