aboutsummaryrefslogtreecommitdiff
path: root/bench/snippets/runner.mjs
blob: 4f6e29fba5e9bed75c401d52ca8f56bc43e08de4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import * as Mitata from "../node_modules/mitata/src/cli.mjs";
import process from "node:process";

const asJSON = !!process?.env?.BENCHMARK_RUNNER;

export function run(opts = {}) {
  opts ??= {};

  if (asJSON) {
    opts.json = true;
  }

  return Mitata.run(opts);
}

export function bench(name, fn) {
  return Mitata.bench(name, fn);
}

export function group(name, fn) {
  return Mitata.group(name, fn);
}