@@ -9,13 +9,15 @@ const path = require('path');
9
9
// tends to be minimal and fewer operations are done to generate
10
10
// these so that the startup cost is still dominated by a more
11
11
// indispensible part of the CLI.
12
+ // NOTE: not all tools are present in tarball hence need to filter
13
+ const availableCli = [
14
+ 'tools/node_modules/eslint/bin/eslint.js' ,
15
+ 'deps/npm/bin/npx-cli.js' ,
16
+ 'deps/npm/bin/npm-cli.js' ,
17
+ 'deps/corepack/dist/corepack.js' ,
18
+ ] . filter ( ( cli ) => existsSync ( path . resolve ( __dirname , '../../' , cli ) ) ) ;
12
19
const bench = common . createBenchmark ( main , {
13
- cli : [
14
- 'tools/node_modules/eslint/bin/eslint.js' ,
15
- 'deps/npm/bin/npx-cli.js' ,
16
- 'deps/npm/bin/npm-cli.js' ,
17
- 'deps/corepack/dist/corepack.js' ,
18
- ] ,
20
+ cli : availableCli ,
19
21
count : [ 30 ] ,
20
22
} ) ;
21
23
@@ -47,10 +49,6 @@ function spawnProcess(cli, bench, state) {
47
49
48
50
function main ( { count, cli } ) {
49
51
cli = path . resolve ( __dirname , '../../' , cli ) ;
50
- if ( ! existsSync ( cli ) ) {
51
- return ;
52
- }
53
-
54
52
const warmup = 3 ;
55
53
const state = { count, finished : - warmup } ;
56
54
spawnProcess ( cli , bench , state ) ;
0 commit comments