orbit-db-benchmark-runner
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -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 | ||
}) | ||
}) |
12
416
20714
5
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedcliui@6.0.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedwrap-ansi@6.2.0(transitive)
+ Addedyargs@15.4.1(transitive)
+ Addedyargs-parser@18.1.3(transitive)
- Removedansi-regex@4.1.1(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedcliui@5.0.0(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedemoji-regex@7.0.3(transitive)
- Removedfind-up@3.0.0(transitive)
- Removedis-fullwidth-code-point@2.0.0(transitive)
- Removedlocate-path@3.0.0(transitive)
- Removedp-locate@3.0.0(transitive)
- Removedpath-exists@3.0.0(transitive)
- Removedstring-width@3.1.0(transitive)
- Removedstrip-ansi@5.2.0(transitive)
- Removedwrap-ansi@5.1.0(transitive)
- Removedyargs@13.3.2(transitive)
- Removedyargs-parser@13.1.2(transitive)
Updatedyargs@^15.4.1