benchmarkify
Advanced tools
Comparing version 1.0.0 to 1.1.0
30
index.js
const _ = require("lodash"); | ||
const Promise = require("bluebird"); | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const mkdir = require("mkdirp"); | ||
const Promise = require("bluebird"); | ||
const chalk = require("chalk"); | ||
@@ -26,3 +29,4 @@ const Benchmark = require("benchmark"); | ||
async: false, | ||
name: "" | ||
name: "", | ||
resultFile: null | ||
}); | ||
@@ -102,2 +106,24 @@ this.suite = new Benchmark.Suite; | ||
if (self.opts.resultFile) { | ||
mkdir.sync(path.dirname(path.resolve(self.opts.resultFile))); | ||
let content = {}; | ||
if (fs.existsSync(self.opts.resultFile)) { | ||
try { | ||
content = JSON.parse(fs.readFileSync(self.opts.resultFile)); | ||
} catch(e) { | ||
// Ignored | ||
} | ||
} | ||
content[self.opts.name] = tests.map(bench => ({ | ||
name: bench.name, | ||
count: bench.hz | ||
})); | ||
content.timestamp = Date.now(); | ||
content.generated = new Date().toString(); | ||
fs.writeFileSync(self.opts.resultFile, JSON.stringify(content, null, 2)); | ||
} | ||
resolve(); | ||
@@ -104,0 +130,0 @@ }); |
{ | ||
"name": "benchmarkify", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Benchmark runner for NodeJS", | ||
"main": "index.js", | ||
"scripts": { | ||
"dev": "node examples" | ||
}, | ||
@@ -20,4 +21,5 @@ "keywords": [ | ||
"lodash": "4.17.4", | ||
"mkdirp": "0.5.1", | ||
"ora": "1.1.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13283
12
252
6
3
+ Addedmkdirp@0.5.1
+ Addedminimist@0.0.8(transitive)
+ Addedmkdirp@0.5.1(transitive)