grunt-istanbul icon indicating copy to clipboard operation
grunt-istanbul copied to clipboard

plugin config is not namespaced

Open yomed opened this issue 8 years ago • 2 comments

Hi, I'm currently using load-grunt-config in order to load grunt task files, each of which contains relevant config for that task. Most plugins will namespace their config. So jsonlint would need config like

jsonlint: {
    src: [ 'some/valid.json' ]
}

And instead, I have jsonlint.js which is loaded and the config is associated with the jsonlint key.

'use strict';

module.exports = function (grunt) {
    grunt.loadNpmTasks('grunt-jsonlint');
    return {
        src: [
            '*.json',
            'src/**/*.json'
        ]
    };
};

However, istanbul does not namespace these, so I can't set up my makeReport task in the same way. Have you considered namespacing some or all of this plugin config? Like:

istanbul: {
    makeReport: {
        src: 'test/coverage/reports/**/*.json',
        options: {
            type: 'lcov',
            dir: 'test/coverage/reports',
            print: 'detail'
        }
    }
}

yomed avatar Jun 02 '16 18:06 yomed

It's worth mentioning that I can just name my file makeReport.js to get around this in my case, though I did find it curious that the config wasn't named similarly to other plugins.

yomed avatar Jun 02 '16 21:06 yomed

Hi @yomed, did you ever work out a fix for this? My build is failing at Warning: Task "istanbul:instrument" not found. Use --force to continue.

I don't want to add the tasks into my Gruntfile and, even if I create separate JS files for the tasks, e.g. grunt/mochaTest.js, it still can't find some tasks. Seems to work for instrument and makeReport but not mochaTest or storeCoverage ..

bcwatson22 avatar Jan 20 '17 15:01 bcwatson22