New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

orbit-db-benchmark-runner

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orbit-db-benchmark-runner - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

.circleci/config.yml

8

cli.js

@@ -69,4 +69,2 @@ #!/usr/bin/env node

console.log(process.cwd())
const benchmarks = require(process.cwd() + '/benchmarks')

@@ -99,3 +97,3 @@ const report = require('./report')

const runOne = async (benchmark) => {
let stats = {
const stats = {
count: 0

@@ -108,3 +106,3 @@ }

let memory = {
const memory = {
before: process.memoryUsage()

@@ -145,3 +143,3 @@ }

const start = async () => {
let results = []
const results = []
const baselineOnly = argv.baseline

@@ -148,0 +146,0 @@ const runnerStartTime = process.hrtime()

{
"name": "orbit-db-benchmark-runner",
"version": "1.0.2",
"version": "1.0.3",
"description": "OrbitDB Benchmark Runner",

@@ -10,3 +10,3 @@ "main": "index.js",

"scripts": {
"test": "mocha --expose-gc"
"test": "nyc mocha --expose-gc"
},

@@ -17,3 +17,3 @@ "author": "aphelionz",

"expose-gc": "^1.0.0",
"yargs": "^13.2.4"
"yargs": "^15.4.1"
},

@@ -39,5 +39,10 @@ "localMaintainers": [

"chai": "^4.2.0",
"mocha": "^6.2.1",
"sinon": "^7.5.0"
"mocha": "^8.1.3",
"nyc": "^15.1.0",
"sinon": "^9.0.3",
"standard": "^14.3.4"
},
"standard": {
"env": "mocha"
}
}

@@ -13,3 +13,3 @@ const repeatStr = (str, len) => {

const reporter = (results) => {
let reports = [{
const reports = [{
name: 'Benchmark Name',

@@ -16,0 +16,0 @@ ops: 'Ops / ms',

@@ -1,199 +0,207 @@

const yargs = require('yargs');
const cli = require('../cli');
const expect = require('chai').expect;
/* eslint-disable no-unused-expressions */
const yargs = require('yargs')
const cli = require('../cli')
const expect = require('chai').expect
describe('CLI Test', () => {
it('should return help output', async () => {
const parser = yargs.command(cli).help()
const output = await new Promise((resolve) => {
parser.parse('--help', (err, argv, output) => {
if (err) throw new Error(err)
it('should return help output', async() => {
const parser = yargs.command(cli).help();
const output = await new Promise((resolve) => {
parser.parse("--help", (err, argv, output) => {
resolve(output);
})
});
expect(output).to.contain("baseline");
expect(output).to.contain("report");
expect(output).to.contain("list");
expect(output).to.contain("grep");
expect(output).to.contain("stressLimit");
expect(output).to.contain("baselineLimit");
expect(output).to.contain("logLimit");
});
resolve(output)
})
})
expect(output).to.contain('baseline')
expect(output).to.contain('report')
expect(output).to.contain('list')
expect(output).to.contain('grep')
expect(output).to.contain('stressLimit')
expect(output).to.contain('baselineLimit')
expect(output).to.contain('logLimit')
})
describe('baseline', () => {
it('should parse basline value', () => {
const yargsCmd = yargs.command(cli)
const yargsResult = yargsCmd.parse(
'cli --baseline', {}
)
expect(yargsResult.baseline).to.be.true
expect(yargsResult.b).to.be.true
})
describe('baseline', () => {
it('should parse basline value', () => {
const yargsCmd = yargs.command(cli);
const yargsResult = yargsCmd.parse(
'cli --baseline', {}
);
expect(yargsResult.baseline).to.be.true;
expect(yargsResult.b).to.be.true;
});
it('should parse basline value when using alias', () => {
const yargsCmd = yargs.command(cli)
const yargsResult = yargsCmd.parse(
'cli -b', {}
)
expect(yargsResult.baseline).to.be.true
expect(yargsResult.b).to.be.true
})
})
it('should parse basline value when using alias', () => {
const yargsCmd = yargs.command(cli);
const yargsResult = yargsCmd.parse(
'cli -b', {}
);
expect(yargsResult.baseline).to.be.true;
expect(yargsResult.b).to.be.true;
});
});
describe('report', () => {
it('should parse report value', () => {
const yargsCmd = yargs.command(cli)
const yargsResult = yargsCmd.parse(
'cli --report', {}
)
expect(yargsResult.report).to.be.true
expect(yargsResult.r).to.be.true
})
describe('report', () => {
it('should parse report value', () => {
const yargsCmd = yargs.command(cli);
const yargsResult = yargsCmd.parse(
'cli --report', {}
);
expect(yargsResult.report).to.be.true;
expect(yargsResult.r).to.be.true;
});
it('should parse report value when using alias', () => {
const yargsCmd = yargs.command(cli)
const yargsResult = yargsCmd.parse(
'cli -r', {}
)
expect(yargsResult.report).to.be.true
expect(yargsResult.r).to.be.true
})
})
it('should parse report value when using alias', () => {
const yargsCmd = yargs.command(cli);
const yargsResult = yargsCmd.parse(
'cli -r', {}
);
expect(yargsResult.report).to.be.true;
expect(yargsResult.r).to.be.true;
});
});
describe('list', () => {
it('should parse list value', () => {
const yargsCmd = yargs.command(cli);
const yargsResult = yargsCmd.parse(
'cli --list', {}
);
expect(yargsResult.list).to.be.true;
expect(yargsResult.l).to.be.true;
});
describe('list', () => {
it('should parse list value', () => {
const yargsCmd = yargs.command(cli)
const yargsResult = yargsCmd.parse(
'cli --list', {}
)
expect(yargsResult.list).to.be.true
expect(yargsResult.l).to.be.true
})
it('should parse report value when using alias', () => {
const yargsCmd = yargs.command(cli);
const yargsResult = yargsCmd.parse(
'cli -l', {}
);
expect(yargsResult.list).to.be.true;
expect(yargsResult.l).to.be.true;
});
});
it('should parse report value when using alias', () => {
const yargsCmd = yargs.command(cli)
const yargsResult = yargsCmd.parse(
'cli -l', {}
)
expect(yargsResult.list).to.be.true
expect(yargsResult.l).to.be.true
})
})
describe('grep', () => {
it('should parse grep value', () => {
const yargsCmd = yargs.command(cli);
const yargsResult = yargsCmd.parse(
'cli --grep append-baseline', {}
);
expect(yargsResult.grep).to.equal('append-baseline');
expect(yargsResult.g).to.equal('append-baseline');
});
describe('grep', () => {
it('should parse grep value', () => {
const yargsCmd = yargs.command(cli)
const yargsResult = yargsCmd.parse(
'cli --grep append-baseline', {}
)
expect(yargsResult.grep).to.equal('append-baseline')
expect(yargsResult.g).to.equal('append-baseline')
})
it('should parse grep value when using alias', () => {
const yargsCmd = yargs.command(cli);
const yargsResult = yargsCmd.parse(
'cli -g append-baseline', {}
);
expect(yargsResult.grep).to.equal('append-baseline');
expect(yargsResult.g).to.equal('append-baseline');
});
it('should show help msg when arg not passed to grep', async() => {
const yargsCmd = yargs.command(cli);
const output = await new Promise((resolve) => {
yargsCmd.parse("cli -g", (err, argv, output) => {
resolve(output);
})
});
expect(output).to.contain("baseline");
expect(output).to.contain("report");
expect(output).to.contain("list");
expect(output).to.contain("grep");
expect(output).to.contain("stressLimit");
expect(output).to.contain("baselineLimit");
expect(output).to.contain("logLimit");
});
});
it('should parse grep value when using alias', () => {
const yargsCmd = yargs.command(cli)
const yargsResult = yargsCmd.parse(
'cli -g append-baseline', {}
)
expect(yargsResult.grep).to.equal('append-baseline')
expect(yargsResult.g).to.equal('append-baseline')
})
describe('stressLimit', () => {
it('should parse stressLimit value', () => {
const yargsCmd = yargs.command(cli);
const yargsResult = yargsCmd.parse(
'cli --stressLimit 300', {}
);
expect(yargsResult.stressLimit).to.equal(300);
});
it('should show help msg when arg not passed to stressLimit', async() => {
const yargsCmd = yargs.command(cli);
const output = await new Promise((resolve) => {
yargsCmd.parse("cli --stressLimit", (err, argv, output) => {
resolve(output);
})
});
expect(output).to.contain("baseline");
expect(output).to.contain("report");
expect(output).to.contain("list");
expect(output).to.contain("grep");
expect(output).to.contain("stressLimit");
expect(output).to.contain("baselineLimit");
expect(output).to.contain("logLimit");
});
});
it('should show help msg when arg not passed to grep', async () => {
const yargsCmd = yargs.command(cli)
const output = await new Promise((resolve) => {
yargsCmd.parse('cli -g', (err, argv, output) => {
if (err) { }
describe('baselineLimit', () => {
it('should parse baselineLimit value', () => {
const yargsCmd = yargs.command(cli);
const yargsResult = yargsCmd.parse(
'cli --baselineLimit 1000', {}
);
expect(yargsResult.baselineLimit).to.equal(1000);
});
it('should show help msg when arg not passed to baselineLimit', async() => {
const yargsCmd = yargs.command(cli);
const output = await new Promise((resolve) => {
yargsCmd.parse("cli --baselineLimit", (err, argv, output) => {
resolve(output);
})
});
expect(output).to.contain("baseline");
expect(output).to.contain("report");
expect(output).to.contain("list");
expect(output).to.contain("grep");
expect(output).to.contain("stressLimit");
expect(output).to.contain("baselineLimit");
expect(output).to.contain("logLimit");
});
});
resolve(output)
})
})
expect(output).to.contain('baseline')
expect(output).to.contain('report')
expect(output).to.contain('list')
expect(output).to.contain('grep')
expect(output).to.contain('stressLimit')
expect(output).to.contain('baselineLimit')
expect(output).to.contain('logLimit')
})
})
describe('logLimit', () => {
it('should parse logLimit value', () => {
const yargsCmd = yargs.command(cli);
const yargsResult = yargsCmd.parse(
'cli --logLimit 1000', {}
);
expect(yargsResult.logLimit).to.equal(1000);
});
it('should show help msg when arg not passed to logLimit', async() => {
const yargsCmd = yargs.command(cli);
const output = await new Promise((resolve) => {
yargsCmd.parse("cli --logLimit", (err, argv, output) => {
resolve(output);
})
});
expect(output).to.contain("baseline");
expect(output).to.contain("report");
expect(output).to.contain("list");
expect(output).to.contain("grep");
expect(output).to.contain("stressLimit");
expect(output).to.contain("baselineLimit");
expect(output).to.contain("logLimit");
});
});
describe('stressLimit', () => {
it('should parse stressLimit value', () => {
const yargsCmd = yargs.command(cli)
const yargsResult = yargsCmd.parse(
'cli --stressLimit 300', {}
)
expect(yargsResult.stressLimit).to.equal(300)
})
});
it('should show help msg when arg not passed to stressLimit', async () => {
const yargsCmd = yargs.command(cli)
const output = await new Promise((resolve) => {
yargsCmd.parse('cli --stressLimit', (err, argv, output) => {
if (err) { }
resolve(output)
})
})
expect(output).to.contain('baseline')
expect(output).to.contain('report')
expect(output).to.contain('list')
expect(output).to.contain('grep')
expect(output).to.contain('stressLimit')
expect(output).to.contain('baselineLimit')
expect(output).to.contain('logLimit')
})
})
describe('baselineLimit', () => {
it('should parse baselineLimit value', () => {
const yargsCmd = yargs.command(cli)
const yargsResult = yargsCmd.parse(
'cli --baselineLimit 1000', {}
)
expect(yargsResult.baselineLimit).to.equal(1000)
})
it('should show help msg when arg not passed to baselineLimit', async () => {
const yargsCmd = yargs.command(cli)
const output = await new Promise((resolve) => {
yargsCmd.parse('cli --baselineLimit', (err, argv, output) => {
if (err) { }
resolve(output)
})
})
expect(output).to.contain('baseline')
expect(output).to.contain('report')
expect(output).to.contain('list')
expect(output).to.contain('grep')
expect(output).to.contain('stressLimit')
expect(output).to.contain('baselineLimit')
expect(output).to.contain('logLimit')
})
})
describe('logLimit', () => {
it('should parse logLimit value', () => {
const yargsCmd = yargs.command(cli)
const yargsResult = yargsCmd.parse(
'cli --logLimit 1000', {}
)
expect(yargsResult.logLimit).to.equal(1000)
})
it('should show help msg when arg not passed to logLimit', async () => {
const yargsCmd = yargs.command(cli)
const output = await new Promise((resolve) => {
yargsCmd.parse('cli --logLimit', (err, argv, output) => {
if (err) { }
resolve(output)
})
})
expect(output).to.contain('baseline')
expect(output).to.contain('report')
expect(output).to.contain('list')
expect(output).to.contain('grep')
expect(output).to.contain('stressLimit')
expect(output).to.contain('baselineLimit')
expect(output).to.contain('logLimit')
})
})
})

@@ -1,12 +0,14 @@

const expect = require('chai').expect;
const sinon = require('sinon');
const reporter = require('../report');
/* eslint-disable no-unused-expressions */
const expect = require('chai').expect
const sinon = require('sinon')
const reporter = require('../report')
describe('ReporterTest', () => {
it('should print empty line when no data passed', () => {
sinon.spy(process.stdout, 'write');
reporter([]);
expect(process.stdout.write.called).to.be.true;
expect(process.stdout.write.calledWithExactly('\n')).to.be.true;
});
});
it('should print empty line when no data passed', () => {
sinon.spy(process.stdout, 'write')
reporter([])
expect(process.stdout.write.called).to.be.true
expect(process.stdout.write.calledWithExactly('\n')).to.be.true
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc