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: nodejs#51145
Refs: nodejs#50684
  • Loading branch information
AdamMajer committed Dec 14, 2023
1 parent 228bc5c commit 35403d7
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 35403d7

Please sign in to comment.