gmc

grunt-mocha-chai-sinon

Simple test runner task for NodeJS

Showing:

Popularity

Downloads/wk

0

GitHub Stars

8

Maintenance

Last Commit

7yrs ago

Contributors

3

Package

Dependencies

5

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

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.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial