Skip to content

Commit

Permalink
benchmark: remove dependency on unshipped tools
Browse files Browse the repository at this point in the history
tools/node_modules is removed from the tarball so it should not be used
as part of unit tests or benchmarks.

Fixes: #51145
Refs: #50684
PR-URL: #51146
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
AdamMajer authored and jasnell committed Dec 25, 2023
1 parent aa87b77 commit 345f15e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions benchmark/misc/startup-cli-version.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
const common = require('../common.js');
const { spawnSync } = require('child_process');
const { existsSync } = require('fs');
const path = require('path');

// This benchmarks the startup of various CLI tools that are already
Expand All @@ -11,6 +12,7 @@ const path = require('path');
const bench = common.createBenchmark(main, {
cli: [
'tools/node_modules/eslint/bin/eslint.js',
'deps/npm/bin/npx-cli.js',
'deps/npm/bin/npm-cli.js',
'deps/corepack/dist/corepack.js',
],
Expand Down Expand Up @@ -45,6 +47,10 @@ function spawnProcess(cli, bench, state) {

function main({ count, cli }) {
cli = path.resolve(__dirname, '../../', cli);
if (!existsSync(cli)) {
return;
}

const warmup = 3;
const state = { count, finished: -warmup };
spawnProcess(cli, bench, state);
Expand Down

0 comments on commit 345f15e

Please sign in to comment.