Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

jasmine-node + istanbul test coverage tool + grunt #272

chicoxyzzy opened this Issue Oct 31, 2013 · 2 comments


None yet
3 participants

I know about https://github.com/jribble/grunt-jasmine-node-coverage/ but I found out that it is outdated (https://github.com/jribble/grunt-jasmine-node-coverage/blob/master/tasks/jasmine-node-task.js#L123)

Is there any working solutions already or must I code my own grunt plugin?

4kochi commented Nov 1, 2013

We use grunt-bg-shell to run istanbul over command line. Have a look at our Gruntfile.js

module.exports = function (grunt) {
    // Project configuration.
        pkg: grunt.file.readJSON('package.json'),
        bgShell: {
            coverage: {
                cmd: 'node node_modules/istanbul/lib/cli.js cover --dir build/coverage node_modules/grunt-jasmine-node/node_modules/jasmine-node/bin/jasmine-node -- test --forceexit'
            cobertura: {
                cmd: 'node node_modules/istanbul/lib/cli.js report --root build/coverage --dir build/coverage/cobertura cobertura'
        open: {
            file: {
                path: 'build/coverage/lcov-report/index.html'
        jasmine_node: {
            specNameMatcher: './*.spec', // load only specs containing specNameMatcher
            projectRoot: 'test',
            requirejs: false,
            forceExit: true,
            jUnit: {
                report: true,
                savePath: 'build/reports/jasmine/',
                useDotNotation: true,
                consolidate: true

    // Load tasks

    // Register tasks.
    grunt.registerTask('test', ['jasmine_node']);
    grunt.registerTask('cover', ['bgShell:coverage', 'open']);

emmenko commented Mar 10, 2014

This is how I do it (in a grunt-shell)

# ...
        stdout: true
        stderr: true
        failOnError: true
        command: 'istanbul cover jasmine-node --captureExceptions test && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage'

@chicoxyzzy chicoxyzzy closed this Dec 10, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment