pocesar/grunt-mocha-istanbul

Blocks further grunt tasks from running

Closed this issue · 4 comments

Any grunt tasks configured to run after mocha_istanbul don't run. With the following I would expect the coveralls task to run after the test suite has run; currently it does not, any task placed after mocha_istanbul does not.

grunt.registerTask("test", [
    "clean:test",
    "jshint",
    "mocha_istanbul:unit",
    "coveralls"
]);

can you provide your gruntfile mocha_istanbul config? if you have an event set ("coverage"), post it as well

Here is my mocha_istanbul config, I have no event set:

mocha_istanbul: {
            options: {
                coverage: true,
                coverageFolder: "<%= config.coverageDir %>",
                reportFormats: ["cobertura","lcov"],
                root: "fmsocket/",
                mochaOptions: {
                    reporter: "spec",
                    recursive: true
                }
            },
            unit: {
                src: ["<%= config.testDir %>bootstrap.spec.js", "<%= config.testDir %>unit/*.spec.js"]
            },
            integration: {
                src: ["<%= config.testDir %>bootstrap.spec.js", "<%= config.testDir %>websockets.spec.js"]
            }
        }

not sure if it's related, but mochaOptions should be an string array, should be mochaOptions: ['--reporter spec', '--recursive']

the coverage option is set to true, which emits an event and waits for the done callback to be called. set it to false or remove the setting. from the README

 Boolean options.coverage (default: false)

Setting this to true makes the task emit a grunt event coverage, 
that will contain the lcov data from the file, containing the following 
callback function(lcovcontent, done), and you must manually call 
done() when you are finished, else the grunt task will hang. 
See more information below

Ah! The issue was having the coverage option set without calling done() as you described above. Thanks a lot!