createRunner([options])


  • options <Object>
    • yieldBetweenSamples <boolean> 在样本回调之间安排事件循环轮次。禁用此功能也会防止基于计时器的中止信号在同步回调之间触发。基准测试超时仍会根据单调截止时间进行检查。默认值: true。
  • 返回:<Object> 一个独立的基准测试运行器,包含有界的 after、afterEach、before、beforeEach、bench、describe、run 和 suite 函数。

创建一个显式启动的基准测试运行器。通过一个运行器进行的声明不会与通过另一个运行器或模块级函数进行的声明相互影响。调用返回的 run() 函数来启动运行器并获得它的 BenchmarksStream。

🌐 Creates an explicitly started benchmark runner. Declarations made through one runner do not interact with declarations made through another runner or through the module-level functions. Call the returned run() function to start the runner and obtain its BenchmarksStream.

每个运行器只能启动一次。它的 run() 函数接受与模块级别的 run() 相同的选项。run({ yieldBetweenSamples }) 会覆盖传递给 createRunner() 的值。

🌐 Each runner can be started once. Its run() function accepts the same options as the module-level run(). run({ yieldBetweenSamples }) overrides the value passed to createRunner().