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.

About

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.initConfig({
        'grunt-mocha-chai-sinon': {
            build: {
                src: ['./specs/**/*.spec.js'],
                options: {
                    ui: 'bdd',
                    reporter: 'spec'
                }
            }
        }
    });

    // load required tasks
    grunt.loadNpmTasks("grunt-mocha-chai-sinon");

    // register tasks for execution chain
    grunt.registerTask('test', [
        'grunt-mocha-chai-sinon'
    ]);


};  
  • 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!