Coder Social home page Coder Social logo

grunt-mocha-chai-sinon's Introduction

grunt-mocha-chai-sinon

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.

Gruntfile Example

// Gruntfile.js
module.exports = function(grunt) {
    
    // configure tasks
    grunt.initConfig({
        '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', [
		'mocha-chai-sinon'
	]);
};	

Test Coverage

Test coverage support is provided by node-jscoverage while source code is coverage enabled with BlancketJS.

In order to activate test coverage you need to create a new configuration for the mocha-chai-sinon task and name it coverage.
The name matter!

'mocha-chai-sinon': {
    build: {
        src: ['./specs/**/*.spec.js'],
        options: {
            ui: 'bdd',
            reporter: 'spec'
        }
    },
    coverage: {
        src: ['./specs/**/*.spec.js'],
        options: {
            ui: 'bdd',
            reporter: 'html-cov',
            quiet: true,
            filter: '/foo/foo1/',
            captureFile: './coverage.html'
        }
    }
}

By default mocha-chai-sinon add test coverage support to all loaded files who match the /project-folder/src/ path but you can configure it with the coverage.options.filter option.

grunt-mocha-chai-sinon's People

Contributors

marcopeg avatar

Watchers

Yoshiya Hinosawa avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.