Coverage.json不是用Jasmine RequireJS和Istanbul在grunt中生成的

时间:2016-03-17 07:23:57

标签: javascript gruntjs requirejs jasmine istanbul

我试图使用grunt-template-jasmine-istanbul根据grunt生成覆盖率报告。规范正确执行但未生成覆盖率报告。

以下是配置文件中的代码:

D

1 个答案:

答案 0 :(得分:0)

我意识到问题在于Src文件无法正确引用。如下更改配置修复了问题:

jasmine: {
    coverage : {

        src: [
           'SinglePageApplications/' + name + '/**/*.js'
        ],
        options: {
            template: require('grunt-template-jasmine-istanbul'),
            specs: [
                    //'../Test.UnitTest.JS/UnitTests/' + name + '/common/*.js',
                    //'../Test.UnitTest.JS/UnitTests/' + name + '/testdata',
                    '../Test.UnitTest.JS/UnitTests/' + name + '/**/*.js'
            ],
            helpers: [
                    'Assets/scripts/ato/helperscript.js'

                    //'Legacy/Shared/common/constants.js'
            ],
            vendor: jasmine.SuperAccounts,
            templateOptions: {
                //files: 'src/assets/js/app/**/*.js',
                coverage: 'bin/coverage/coverage.json',
                report: 'bin/coverage',
                thresholds: {
                    lines: 75,
                    statements: 75,
                    branches: 75,
                    functions: 90
                },
                replace: false,
                template: require('grunt-template-jasmine-requirejs'),
                templateOptions: {
                    requireConfig: {
                        baseUrl: 'SinglePageApplications/' + name,
                        //waitSeconds: 30,
                        paths: mixIn({
                            'knockout-editables': '../../Assets/scripts/vendor/ko.editables-0.9.0',
                            'knockout-validation': '../../Assets/scripts/vendor/knockout.validation-1.0.2',
                            'bignumber': '../../Assets/scripts/vendor/bignumber-1.4.1',
                            'testutils': '../../../Test.UnitTest.JS/Utils',
                            'shared': '../../Legacy/Shared',
                            'testdata': '../../../Test.UnitTest.JS/UnitTests/' + name + '/testdata'
                        }, addConfigurationPaths(config.SuperAccounts))

                    }
                },
                helpers: [
                    'Assets/scripts/ato/helperscript.js'

                    //'Legacy/Shared/common/constants.js'
                ],
                specs: [
                    //'../Test.UnitTest.JS/UnitTests/' + name + '/common/*.js',
                    //'../Test.UnitTest.JS/UnitTests/' + name + '/testdata',
                    '../Test.UnitTest.JS/UnitTests/' + name + '/**/*.js'
                ],
                //junit: {
                //    path: 'build/junit/' + name + '/'
                //},
                timeout: 100000,
                vendor: jasmine.SuperAccounts
            }
        }
        ,
        //specs : 'src/test/js/unit-headless.html',

        phantomjs: {
            'ignore-ssl-errors': true
        },


    }

}