From 345f15e493162e27fd8b543b7bc995aa45469639 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Wed, 13 Dec 2023 14:34:39 +0100 Subject: [PATCH] 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: https://github.com/nodejs/node/issues/51145 Refs: https://github.com/nodejs/node/pull/50684 PR-URL: https://github.com/nodejs/node/pull/51146 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- benchmark/misc/startup-cli-version.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/benchmark/misc/startup-cli-version.js b/benchmark/misc/startup-cli-version.js index 52ab6bc9f582f3..4dbeb81fc70740 100644 --- a/benchmark/misc/startup-cli-version.js +++ b/benchmark/misc/startup-cli-version.js @@ -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 @@ -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', ], @@ -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);