Skip to content

Commit 4be33b5

Browse files
AdamMajerrichardlau
authored andcommitted
benchmark: remove dependency on unshipped tools
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>
1 parent d76e16b commit 4be33b5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

benchmark/misc/startup-cli-version.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22
const common = require('../common.js');
33
const { spawnSync } = require('child_process');
4+
const { existsSync } = require('fs');
45
const path = require('path');
56

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

4648
function main({ count, cli }) {
4749
cli = path.resolve(__dirname, '../../', cli);
50+
if (!existsSync(cli)) {
51+
return;
52+
}
53+
4854
const warmup = 3;
4955
const state = { count, finished: -warmup };
5056
spawnProcess(cli, bench, state);

0 commit comments

Comments
 (0)