-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7430ba4
commit 843867a
Showing
3 changed files
with
9 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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[] | ||
} |