简体   繁体   中英

grunt template jasmine istanbul is not generating coverage report

Im using grunt-template-jasmine-istanbul and grunt-template-jasmine-requirejs. When I run test coverage module, all my test cases are running successfully but no coverage is generated.

jasmine: {
            coverage: {
            src: [...],
            options: {
                specs: '...',
                vendors: [...],
                template: require('grunt-template-jasmine-istanbul'),
                templateOptions: {
                    coverage: 'bin/coverage/coverage.json',
                    report: 'bin/coverage',
                    template: require('grunt-template-jasmine-requirejs'),
                    templateOptions: {
                        requireConfig: {
                            baseUrl: '...',
                        }
                    }
                }
            }
          }
        }

We have faced the exact issue in our setup.. The issue is just because of a incorrect path in the src path. So, please ensure you have configured your paths correctly..

Below is the sample code which worked for us. The issue should be exactly in your source path configuration.

jasmine : {
    coverage : {
        src : [
        'web/js/sad/service/common/model/**/*.js' ],
        options : {
            specs : [ 'tests/**/*.js' ],
            template : require('grunt-template-jasmine-istanbul'),
            vendor : [ '../3rdParty/extjs-4.1.0/*.js',
                    'web/js/common/controller/**/*.js' ],
            templateOptions : {
                coverage : 'bin/coverage/coverage.json',
                report : 'bin/coverage',
                thresholds : {
                    lines : 5,
                    statements : 5,
                    branches : 1,
                    functions : 1
                }
            }
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM