Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including mocha-standard with all npm packages installed. Try it out:

var mochaStandard = require("mocha-standard")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

mocha-standard v1.0.0

Integrate the JS standard to your Mocha tests


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



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 tests.

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


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' ]))


To use semistandard instead, use:

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


mocha-standard © 2015+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).  ·  GitHub @rstacruz  ·  Twitter @rstacruz

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free