4

私は grunt-template-jasmine-istanbul と grunt-template-jasmine-requirejs を使用しています。テスト カバレッジ モジュールを実行すると、すべてのテスト ケースが正常に実行されますが、カバレッジが生成されません。

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

1 に答える 1

1

セットアップで正確な問題に直面しました..問題は、src パスのパスが正しくないことが原因です。そのため、パスが正しく構成されていることを確認してください..

以下は、私たちのために働いたサンプルコードです。問題は、ソース パスの構成に正確に含まれている必要があります。

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
                }
            }
        }
    }
}
于 2016-01-12T13:45:43.483 に答える