From 67bbd2c94485800b40fafe5f599547c352909e5b Mon Sep 17 00:00:00 2001 From: Brian White Date: Sat, 15 Apr 2017 02:51:10 -0400 Subject: [PATCH] benchmark: improve cli error message When no matching benchmark files are found, a more sensible error is shown now. PR-URL: https://github.com/nodejs/node/pull/12421 Reviewed-By: Joyee Cheung Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Alexey Orlenko Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- benchmark/_cli.js | 2 ++ benchmark/compare.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/benchmark/_cli.js b/benchmark/_cli.js index 17718c4c4d757a..4d92b05b1b82b4 100644 --- a/benchmark/_cli.js +++ b/benchmark/_cli.js @@ -88,6 +88,8 @@ CLI.prototype.benchmarks = function() { const filter = this.optional.filter || false; for (const category of this.items) { + if (benchmarks[category] === undefined) + continue; for (const scripts of benchmarks[category]) { if (filter && scripts.lastIndexOf(filter) === -1) continue; diff --git a/benchmark/compare.js b/benchmark/compare.js index a671bc9f3d7be6..4d183a10e2b97d 100644 --- a/benchmark/compare.js +++ b/benchmark/compare.js @@ -35,7 +35,7 @@ const runs = cli.optional.runs ? parseInt(cli.optional.runs, 10) : 30; const benchmarks = cli.benchmarks(); if (benchmarks.length === 0) { - console.error('no benchmarks found'); + console.error('No benchmarks found'); process.exitCode = 1; return; }