Open History to see the last commit
1import { afterEach, beforeEach, bench, describe } from 'vitest'
2import { LINK_CASES } from './cases'
3import { createClientScenario, samplingOptions } from './scenario'
4import type * as App from './src/client'
5β
6const appModulePath = './dist/client/app.js'
7const app: typeof App = await import(/* @vite-ignore */ appModulePath)
8if (app.serverEnvironment !== false) {
9 throw new Error('Link client benchmarks must use the production client build')
10}
11β
12for (const { id, label } of LINK_CASES) {
13 describe(label, () => {
14 const scenario = createClientScenario(app, id)
15 function finish() {
16 try {
17 scenario.check()
18 } finally {
19 scenario.teardown()
20 }
21 }
22 beforeEach(scenario.setup)
23 afterEach(finish)
24β
25 bench(`client Links: ${id}`, scenario.batch, {
26 ...samplingOptions,
27 setup: scenario.setup,
28 teardown: finish,
29 })
30 })
31}