Browse Source

Allow filtering benchmark tests with CLI args

master
Luke Childs 5 years ago
parent
commit
937bb9e180
  1. 19
      bench/index.js
  2. 3
      package.json

19
bench/index.js

@ -1,3 +1,4 @@
const {argv} = require('yargs');
const prettyMs = require('pretty-ms');
const Vain = require('..');
@ -5,6 +6,22 @@ const isCI = process.env.CI;
const xpub = 'xpub6EDZZg3os4RaLxfPpnGBb7ajm6ccyjRs3PGZ5jNK31rPnbpyKb7dc87cEPaLEjFYDBGCQT8VMm8q8MVj2tj7HPBu8syxu82cdHLCNaQmT42';
// Filter benchmark tests with arguments like:
// $ npm run bench
// $ npm run bench -- --key-format=wif
// $ npm run bench -- --address-format=p2pkh
// $ npm run bench -- --key-format=wif --address-format=p2pkh
const filterOptionsFromArgs = options => {
if (
(argv.keyFormat && argv.keyFormat !== options.keyFormat) ||
(argv.addressFormat && argv.addressFormat !== options.addressFormat)
) {
return false;
}
return true;
};
const options = [
{
keyFormat: 'wif',
@ -65,7 +82,7 @@ const options = [
m: 2,
prefix: 'BTC'
}
];
].filter(filterOptionsFromArgs);
options.forEach(options => {
console.log();

3
package.json

@ -37,6 +37,7 @@
"dependencies": {
"bip39": "^3.0.2",
"bitcoinjs-lib": "^5.0.3",
"tiny-emitter": "^2.1.0"
"tiny-emitter": "^2.1.0",
"yargs": "^14.2.0"
}
}

Loading…
Cancel
Save