Last active
December 21, 2015 21:08
-
-
Save vtanathip/6365922 to your computer and use it in GitHub Desktop.
Config karma.conf.js to show code coverage report and clean every-time to run server. ( Then just run unit test and it will auto-generate file by istanbul engine )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clean: { | |
dist: { | |
files: [{ | |
dot: true, | |
src: [ | |
'.tmp', | |
'<%= yeoman.dist %>/*', | |
'!<%= yeoman.dist %>/.git*' | |
] | |
}] | |
}, | |
//clear folder coverage | |
server: ['.tmp','coverage'] | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add report coverage | |
preprocessors = { | |
'app/scripts/**/*.js': 'coverage' | |
} | |
//coverage report | |
coverageReporter = { | |
type : 'html', | |
dir : 'coverage/' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Don't forget to ignore this folder before push it | |
coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grunt.registerTask('server', function (target) { | |
if (target === 'dist') { | |
return grunt.task.run(['build', 'open', 'connect:dist:keepalive']); | |
} | |
grunt.task.run([ | |
//when run server it will clean folder coverage automatic | |
'clean:server', | |
'replace:local', | |
'karma:unit', | |
'concurrent:server', | |
'connect:livereload', | |
'open', | |
'watch' | |
]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment