无法使用requirejs运行Grunt-jsmine-istanbul的代码覆盖率

时间:2016-05-12 11:01:06

标签: javascript code-coverage istanbul grunt-contrib-jasmine grunt-istanbul

我一直在运行jasmine单元测试并且长时间使用伊斯坦布尔进行代码覆盖但是现在我遇到了一个使用requirejs的项目,我无法为它运行Istanbul-Code-Coverage测试。

代码成功提供运行jasmine测试但生成节点代码覆盖

    jasmine: {
        test: {
            src: ['preview_export/scripts/loadPresentation.js', 'scripts/libs/**/*.js', 'components/codemirror/codemirror.js',
                'bundles/**/*.js', 'scripts/common/collections/MultiMap.js',
                'scripts/framework/ServiceRegistry.js'],
            options: {
                specs: ['jtest/spec/**/*.js'],
                helpers: [
                    'node_modules/jasmine-ajax/lib/mock-ajax.js',
                    'app/scripts/mixpanel.js',
                    'app/scripts/constant.js', 'app/preview_export/download_assist/swfobject.js',
                    'app/scripts/common/util.js'],
                template: require('grunt-template-jasmine-requirejs'),
                templateOptions: {
                    requireConfigFile:'jasmine-require-config.js',
                    requireConfig: {
                        paths: {
                            'JST' : 'scripts/compiled-templates',
                            'framework' : 'scripts/framework'
                        }
                    }
                }
            }
        },
        coverage: {
            src: ['preview_export/scripts/loadPresentation.js', 'scripts/libs/**/*.js', 'components/codemirror/codemirror.js',
                'bundles/**/*.js', 'scripts/common/collections/MultiMap.js',
                'scripts/framework/ServiceRegistry.js'],
            options: {
                specs: ['jtest/spec/**/*.js'],
                template: require('grunt-template-jasmine-istanbul'),
                templateOptions: {
                    coverage: 'bin/coverage/coverage.json',
                },
                report: [
                        {
                            type: 'html',
                            options: {
                                dir: 'bin/cover/html'
                            }
                        },
                        {
                            type: 'cobertura',
                            options: {
                                dir: '<%= meta.bin.coverage %>/cobertura'
                            }
                        },
                        {
                            type: 'text-summary'
                        }
                    ]

            }

        }
    }

0 个答案:

没有答案