1. mocha-standard
Integrate the JS standard to your Mocha tests
mocha-standard
Package: mocha-standard
Created by: rstacruz
Last modified: Mon, 20 Jun 2022 01:45:23 GMT
Version: 1.0.0
License: MIT
Downloads: 6,666
Repository: https://github.com/rstacruz/mocha-standard

Install

npm install mocha-standard
yarn add mocha-standard

mocha-standard

Integrates standard into your mocha tests. This allows you to enforce a "one true" JavaScript coding style in your project via Mocha tests.



Status


Features

This offers a finer alternative to adding standard into package.json's scripts.test block.

  • Runs in the same node process as mocha, removing maybe 500ms of startup time.
  • Use mocha --watch to recheck for style failures. standard is used programatically, removing a huge overhead (around 1500ms) in re-running it repeatedly with --watch.
  • Painlessly integrate standard into your travisci.org tests.

(Your speed gains may be a bit different from my Pentium II, of course.)


Usage

Install it:

 npm install --save-dev mocha-standard standard

Then add this test file to your Mocha suite:

 /* test/standard_test.js */
it('conforms to standard', require('mocha-standard'))

To configure what files to consume:

 var standard = require('mocha-standard')
it('conforms to standard', standard.files([ 'index.js', 'test/*.js' ]))

Semicolons

To use semistandard instead, use:

 npm install --save-dev mocha-standard semistandard
 /* test/standard_test.js */
it('conforms to standard', require('mocha-standard/semistandard'))

Thanks

mocha-standard © 2015+, Rico Sta. Cruz. Released under the MIT License.

Authored and maintained by Rico Sta. Cruz with help from contributors (list).

ricostacruz.com  · 
GitHub @rstacruz  · 
Twitter @rstacruz

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code