diff options
Diffstat (limited to 'benchmark/bench/cli-startup.js')
-rw-r--r-- | benchmark/bench/cli-startup.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/benchmark/bench/cli-startup.js b/benchmark/bench/cli-startup.js index aa8880554..6f2555499 100644 --- a/benchmark/bench/cli-startup.js +++ b/benchmark/bench/cli-startup.js @@ -1,5 +1,5 @@ import { fileURLToPath } from 'node:url'; -import { execaCommand } from 'execa'; +import { exec } from 'tinyexec'; import { markdownTable } from 'markdown-table'; import { astroBin, calculateStat } from './_util.js'; @@ -14,11 +14,11 @@ export async function run(projectDir, outputFile) { const root = fileURLToPath(projectDir); console.log('Benchmarking `astro --help`...'); - const helpStat = await benchmarkCommand(`node ${astroBin} --help`, root); + const helpStat = await benchmarkCommand('node', [astroBin, '--help'], root); console.log('Done'); - console.log('Benchmarking `astro info`...'); - const infoStat = await benchmarkCommand(`node ${astroBin} info`, root); + console.log('Benchmarking `astro preferences list`...'); + const infoStat = await benchmarkCommand('node', [astroBin, 'preferences', 'list'], root); console.log('Done'); console.log('Result preview:'); @@ -35,16 +35,17 @@ export async function run(projectDir, outputFile) { /** * @param {string} command + * @param {string[]} args * @param {string} root * @returns {Promise<import('./_util.js').Stat>} */ -async function benchmarkCommand(command, root) { +async function benchmarkCommand(command, args, root) { /** @type {number[]} */ const durations = []; for (let i = 0; i < 10; i++) { const start = performance.now(); - await execaCommand(command, { cwd: root }); + await exec(command, args, { nodeOptions: { cwd: root } }); durations.push(performance.now() - start); } |