Browse Source

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 <joyeec9h3@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
Brian White 8 years ago
committed by James M Snell
parent
commit
ccdcd9168a
  1. 2
      benchmark/_cli.js
  2. 2
      benchmark/compare.js

2
benchmark/_cli.js

@ -88,6 +88,8 @@ CLI.prototype.benchmarks = function() {
const filter = this.optional.filter || false; const filter = this.optional.filter || false;
for (const category of this.items) { for (const category of this.items) {
if (benchmarks[category] === undefined)
continue;
for (const scripts of benchmarks[category]) { for (const scripts of benchmarks[category]) {
if (filter && scripts.lastIndexOf(filter) === -1) continue; if (filter && scripts.lastIndexOf(filter) === -1) continue;

2
benchmark/compare.js

@ -35,7 +35,7 @@ const runs = cli.optional.runs ? parseInt(cli.optional.runs, 10) : 30;
const benchmarks = cli.benchmarks(); const benchmarks = cli.benchmarks();
if (benchmarks.length === 0) { if (benchmarks.length === 0) {
console.error('no benchmarks found'); console.error('No benchmarks found');
process.exitCode = 1; process.exitCode = 1;
return; return;
} }

Loading…
Cancel
Save