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

plainspec-mocha-reporter

v1.0.11

Published

A simple mocha-reporter for console useful when testing async calls.

Downloads

21

Readme

plainspec-mocha-reporter

code style: prettier

plainspec reporter for Mocha.

The plainspec-mocha-reporter is a reporter for mocha.
Useful for scenarios when async calls are logged so that console is clean for test report and view.

Installation

Save it as dev dependency in your project npm install plainspec-mocha-reporter --save-dev

or

Do a npm install after plainspec-mocha-reporter as devDependencies to your package.json file

//package.json
"devDependencies": {
  ..
  "plainspec-mocha-reporter": "^1.0.9",
  ..
}

Usage

Refer Mocha Third party reporters

and then run to see output

mocha --reporter plainspec-mocha-reporter --check-leaks test/

or look at configuration options below.

For npm test in package.json in script section add

..
"scripts": {
    "test": "node_modules/mocha/bin/_mocha --reporter plainspec-mocha-reporter  test/*.js"
  },
..

Features and Differences

node_modules/mocha/bin/_mocha --reporter plainspec-mocha-reporter test/http*.js --exit --reporter-options epilogue

Screenshot

vs

node_modules/mocha/bin/_mocha --reporter spec test/http*.js --exit --reporter-options

Screenshot

Full configuration options

| Parameter | Effect | | --------- | ------ | | startMessage | Starting Message (defaults to 'Release') | | suitePad | Padding used between suits,pass,fail (defaults to ' ') | | rootMessage | The report name (defaults to ' Mocha Custom Report ') | | padCount | Padding for the char in padChar. (defaults to '26') | | padChar | The char (defaults to '=') | | epilogue | enable disable epilogue (defaults to false) |

Example output

mocha --reporter spec --check-leaks test/

  #hello world
    ✓ should return hello world


  1 passing (7ms)

with Custom report with symbol ok mocha --reporter plainspec-mocha-reporter --check-leaks test/

========================== Mocha Custom Start Report ==========================
	 Testing Release possibility
	 suite #hello world
		 ✓ should return hello world (1ms)
	 Summary: ✓ Passed:1 tests ✖ Failed:0 test Total:1/1
     Result: Release not possible
========================== Mocha Custom End Report ============================

where test/ folder has following test File

\\ test\test.js
"use strict";
var chai = require('chai')
var should = chai.should()
//test hello
describe('#hello world', function() {
  it('should return hello world', function() {
    let test = 'hello world';
    test.should.eql('hello world');
  });
});

and with symbol err

========================== Mocha Custom Start Report ==========================
	 Testing Release possibility
	 suite #hello world
		 ✖ should return hello world AssertionError: expected 'hello world' to deeply equal 'hello world nope'
    at Context.<anonymous> (test/test.js:8:17)
	 Result: Passed:0 Failed:1 Total:0/1
   Summary: ✓ Passed:0 tests ✖ Failed:1 test Total:0/1
   Result: Release not possible
========================== Mocha Custom End Report ============================

where test/ folder has following test File

\\ test\test.js
"use strict";
var chai = require('chai')
var should = chai.should()
//test hello
describe('#hello world', function() {
  it('should return hello world', function() {
    let test = 'hello world';
    test.should.eql('hello world nope');
  });
});

with customization node_modules/mocha/bin/_mocha --reporter index --check-leaks test/ --reporter-options rootMessage="StarShip Enterprise Test",padChar="+",padCount=30,suitePad=" ",startMessage="Take Off"


++++++++++++++++++++++++++++++StarShip Enterprise Test++++++++++++++++++++++++++++++
Testing Take Off possibility

   #Fly
   ✓ should return weapons ready (1ms)
   ✓ should return weather ok (0ms)
      #Pilots
      ✓ should return Pilots ready (0ms)
      ✓ should return Signal ready (0ms)
      ✓ should return Ammmo ready (0ms)
      ✖ should return Radar ready AssertionError: expected 'Radar ready' to deeply equal 'Radar not  ready'
    at Context.<anonymous> (test/nested-test.js:32:19) ~/plainspec-mocha-reporter/test/nested-test.js
   #Fleet Ready
   ✓ should be Fueled (0ms)
   ✓ should return check Engine (0ms)

Summary: ✓ Passed:7 tests ✖ Failed:1 test Total:7/8
Result: Take Off not possible

++++++++++++++++++++++++++++++StarShip Enterprise Test++++++++++++++++++++++++++++++

without node_modules/mocha/bin/_mocha --reporter index --check-leaks test/

========================== Mocha Custom Report ==========================
Testing Release possibility

 #Fly
 ✓ should return weapons ready (1ms)
 ✓ should return weather ok (0ms)
  #Pilots
  ✓ should return Pilots ready (0ms)
  ✓ should return Signal ready (0ms)
  ✓ should return Ammmo ready (0ms)
  ✖ should return Radar ready AssertionError: expected 'Radar ready' to deeply equal 'Radar not  ready'
    at Context.<anonymous> (test/nested-test.js:32:19) ~/plainspec-mocha-reporter/test/nested-test.js
 #Fleet Ready
 ✓ should be Fueled (0ms)
 ✓ should return check Engine (0ms)

Summary: ✓ Passed:7 tests ✖ Failed:1 test Total:7/8
Result: Release not possible

========================== Mocha Custom Report ==========================

Support

Feel free to reach out with your questions or concerns.PRs welcome.

Bipul K Kuri