mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
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 <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
aa87b776cd
commit
345f15e493
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user