最近、Linux マシンに 2 つのパッケージを含む grunt をダウンロードしました。
- コマンド ライン ジャスミン ユニット テスト用の Grunt-contrib-jasmine。
私が従ったガイド: https://github.com/gruntjs/grunt-contrib-jasmine
- コード カバレッジ用の Grunt-template-jasmine-Istanbul。
私が従ったガイド: https://github.com/maenu/grunt-template-jasmine-istanbul
私のうなり声フォルダー全体が非常に大きいことがわかり、それをスリム化する方法があるかどうか疑問に思っていました. 最上位の node_modules フォルダーに、grunt、grunt-contrib-jasmine、grunt-template-jasmine-Istanbul というパッケージがあります。冗長だと思ったファイルを削除してみましたが、繰り返してもほとんどのライブラリが必要なようです。
GruntFile を投稿します。それが役立つ場合があります。
module.exports = function(grunt) {
grunt.initConfig({
jasmine: {
coverage: {
src: 'src/*.js',
options: {
specs: 'spec/*Spec.js',
helpers: 'spec/*Helper.js',
vendor: ['lib/jquery.js', 'lib/angular.js', 'lib/angular-touch.js', 'lib/angular-route.js', 'lib/angular-cookies.js',
'lib/ui-bootstrap.js', 'lib/jasmine-jquery.js', 'lib/angular-mocks.js'],
template: require('grunt-template-jasmine-istanbul'),
templateOptions: {
coverage: 'coverage/coverage.json',
report: {
type: 'cobertura',
options: {
dir: 'coverage/cobertura'
}
},
thresholds: {
lines: 50,
statements: 50,
branches: 50,
functions: 50
}
}
}
}
}
});
// Register tasks.
grunt.loadNpmTasks('grunt-contrib-jasmine');
// Default task.
grunt.registerTask('default', 'jasmine');
};
どんな助けでも大歓迎です。
編集: node_modules が繰り返されるため、ファイル パスが長すぎて、ジェンキンのビルドが許可されません。