GruntJS + MochaJS + ChaiJS + SinonJS

I just released a little NPM Package to make NodeJS testing easier.

It works as GruntJS task to be part of your build process.


This is a simple test runner for GruntJS using MochaJS as test framework, ChaiJS as assertion library for BDD and TDD and SinonJS as spyes/stubs/mocks utility library.

Install with NPM

The quickest way to install is to use npm package manager.
Check our page on NPM

npm install grunt-mocha-chai-sinon --save-dev

Gruntfile Example

// Gruntfile.js  
module.exports = function(grunt) {

    // configure tasks
        'grunt-mocha-chai-sinon': {
            build: {
                src: ['./specs/**/*.spec.js'],
                options: {
                    ui: 'bdd',
                    reporter: 'spec'

    // load required tasks

    // register tasks for execution chain
    grunt.registerTask('test', [

  • omouse

    Does this require a browser at all for testing? All the other test runners and tasks I’ve seen keep using phantomjs or firefox or some other browser, it’s really annoying when I just want to run server-side tests.

    • mpeg

      This is meant to be a NodeJS testing library. I do not use any headless browser on that so it is very quick.

      For the client side testing I use KarmaJS and I’m gonna writing a plugin to embed the same functionalities… but I still don’t have a release date yet!

      • omouse

        Awesome thanks!

  • Tony

    This does not work. Trying to run this provides the following errors:

    Loading “mocha-chai-sinon.js” tasks…ERROR

    >> TypeError: Cannot read property ‘coverage’ of undefined

    Warning: Task “default” not found. Use –force to continue.

    • mpeg

      I’ll check it out, maybe some upgrades in the dependency tree broke something. Of course you are welcome to try to fix it yourself and contribute to the repo with a PR as my time for it is thin as the ice during spring!