Grunt template jasmine istanbul does not generate coverage report

Im using grunt-template-jasmine-istanbul and grunt-template-jasmine-requirejs. When I run the test coverage module, all my test cases succeed, but coverage is not 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: '...',
                        }
                    }
                }
            }
          }
        }
+4
source share
1 answer

We encountered the exact problem in our installation. The problem is only the wrong path in the src path. So make sure you set your paths correctly.

Below is an example of code that worked for us. The problem should be exactly in the configuration of the source path.

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
                }
            }
        }
    }
}
+1

Source: https://habr.com/ru/post/1621041/


All Articles