Skip to content

Commit

Permalink
chore: fix benchmark runner
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Nov 23, 2024
1 parent 7430ba4 commit 843867a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
2 changes: 1 addition & 1 deletion scripts/bench-file/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async function main() {
watch: false,
pool: 'vmThreads',
includeTaskLocation: true,
config: new URL('../vitest.config.ts', import.meta.url).pathname,
config: new URL('../../../vitest.config.ts', import.meta.url).pathname,
benchmark: {
reporters: [
reportToBenchmarkHandler(report => {
Expand Down
12 changes: 0 additions & 12 deletions scripts/bench-file/vitest.config.ts

This file was deleted.

19 changes: 8 additions & 11 deletions scripts/benchmarks/src/runner.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { execa } from 'execa'
import type { BenchmarkReport } from './reporter.ts'

const tsx = './scripts/benchmarks/node_modules/.bin/tsx'
const runner = './scripts/benchmarks/vitest-bench.ts'

export function runVitest(file: string) {
export async function runVitest(file: string) {
console.log(`Running benchmarks in ./${file}`)

return execa(tsx, [runner, file], { reject: false }).then(result => {
if (result.exitCode !== 0) {
console.error(result.stderr)
throw new Error('Benchmark failed. See above for details.')
}
return JSON.parse(result.stdout) as BenchmarkReport[]
const result = await execa('node', ['scripts/run', 'bench-file', file], {
reject: false,
})
if (result.exitCode !== 0) {
console.error(result.stderr)
throw new Error('Benchmark failed. See above for details.')
}
return JSON.parse(result.stdout) as BenchmarkReport[]
}

0 comments on commit 843867a

Please sign in to comment.