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

mocha-insights-reporter

v1.0.28-beta.10

Published

Get Performance Insights Of Your App By Simply Testing It!

Downloads

114

Readme

mocha-insights-reporter

A pluggable Mocha reporter that give insights on the app performance based on duration of tests, and gives the result as an excel file. You may use your favorite reporter, insights run in background.

This package is in Beta, but I invite you to give this a try and submit your ideas.

The idea

mocha-insights-reporter is a reporter for mocha. It gives you performance matrix of your app based on each test cases duration.

  • it creates logs whenever you run tests with this reporter included.
  • you don't have to change your code to integrate this reporter.
  • usually run silently and wont output wired stuff to console and make it ugly.
  • by default, it generates mocha-insights directory in your application root (you may gitignore this directory).
  • every logs and reports will be stored there.
  • separate logs and reports for different NODE_ENV environment.
  • run mocha-insights to compile the report from logs.

How to setup?

step 1: get stuffs

You need the following dependencies to get this running.

  • mocha : our awesome test framework,
  • mocha-insights-reporter : (this package) and
  • mocha-multi : get multiple reporters working with mocha

Get them all.

npm install --save-dev mocha mocha-insights-reporter mocha-multi

step 2: integrate

Assumptions

  • Assuming you are already using the default spec reporter. Else change the setup accordingly. Its simple.
  • Assuming your tests are at ./tests directory.

Setup

  • open your package.json
  • create or modify your test and insights tag under the scripts section as follows.
"scripts": {
   	....
   	"test": "./node_modules/.bin/mocha ./tests --recursive --reporter mocha-multi --reporter-options spec=-,mocha-insights-reporter=-",
   	"insights": "./node_modules/.bin/mocha-insights",
        ....
}

Note that mocha-insights-reporter needs to output end result to the console. So please use ... mocha-insights-reporter=- while using with mocha-multi.

To know more about how mocha-multi works, please refer their doc.

step 3: run

Run tests

npm test

to run your predefined test suit and generate log of that at ./mocha-insights/logs/{NODE_ENV}/ folder.

Generate report

npm run insights

to generate report in the excel format at ./mocha-insights/ folder.

Licence

MIT © Vajahath Ahmed