npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

karma-benchmark-json-reporter

v1.0.1

Published

A reporter for karma-benchmark outputting results to a JSON file

Downloads

119

Readme

karma-benchmark-json-reporter

npm version

Build Status Coverage Status

Dependency Status devDependency Status Greenkeeper badge

A reporter for karma-benchmark outputting results to a JSON file.

Install

npm install karma-benchmark-json-reporter

Setting up

After installing karma, karma-benchmark and your favorite launcher, in your karma.conf.js:

module.exports = function (config) {
  config.set({
    frameworks: ['benchmark'],
    reporters: ['benchmark-json'],

    // other karma options

    // options for 'karma-benchmark-json-reporter'
    benchmarkJsonReporter: {
      pathToJson: 'my-benchmark-results.json'
    }
  })
}

See complete working examples for more details.

API

The benchmarkJsonReporter option container has three settings:

pathToJson

String or array of strings corresponding to the path(s) from the karma basePath of the output JSON file(s).

Default: results.json from the karma basePath.

By setting pathToJson to an array of paths and customizing formatOutput, one can generate multiple output files. See this example for more.

formatResults

Function that takes in the compiled results array and is expected to return an object that is passed to formatOutput.

Default: the identity function.

Each compiled results item corresponds to one benchmark run has the following keys:

  • fullName: full (and unique) run name concatenating browser, suite and name values
  • browser: name of browser used
  • suite: name of suite (as set in suite('<>', function () {})
  • name: name of benchmark (as set in benchmark('<>', function () {})
  • count: number of times the test was executed
  • cycles: number of cycles performed while benchmarking
  • hz: number of operations per second
  • hzDeviation: standard deviation in hz
  • mean: mean in seconds
  • deviation: standard deviation in seconds
  • variance: variance in seconds^2
  • moe: margin of error
  • rme: relative margin of error (in percentage of the mean)
  • sem: standard error of the mean
  • sample: list of sample points

Note that the compiled results are sorted from fastest to slowest hz values before being passed to formatResults.

formatOutput

Function that takes the output of formatResults and is expected to return a JSON-serializable object that will be written in the output file(s).

Defaults: function (results) { return { results: results } }.

If formatOutput returns an array, then items in the array will be written in separate JSON files in the same order as the given pathToJson array setting.

Otherwise, the formatOutput return value gets JSON stringified into a single JSON file located at pathToJson.

Credits

2018 Étienne Tétreault-Pinard. MIT License

Standard - JavaScript Style Guide