Gruntfile.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 'use strict';
  2. module.exports = function (grunt) {
  3. require('load-grunt-tasks')(grunt);
  4. grunt.initConfig({
  5. jshint: {
  6. options: {
  7. jshintrc: '.jshintrc'
  8. },
  9. files: [
  10. 'Gruntfile.js',
  11. 'bin/*',
  12. 'lib/**/*.js',
  13. 'test/**/*.js',
  14. '!test/assets/**/*',
  15. '!test/reports/**/*',
  16. '!test/tmp/**/*'
  17. ]
  18. },
  19. simplemocha: {
  20. options: {
  21. reporter: 'spec',
  22. timeout: '5000'
  23. },
  24. full: {
  25. src: ['test/test.js']
  26. },
  27. short: {
  28. options: {
  29. reporter: 'dot'
  30. },
  31. src: ['test/test.js']
  32. }
  33. },
  34. exec: {
  35. assets: {
  36. command: 'node test/packages.js && node test/packages-svn.js'
  37. },
  38. 'assets-force': {
  39. command: 'node test/packages.js --force && node test/packages-svn.js --force'
  40. },
  41. cover: {
  42. command: 'STRICT_REQUIRE=1 node node_modules/istanbul/lib/cli.js cover --dir ./test/reports node_modules/mocha/bin/_mocha -- -R dot test/test.js'
  43. },
  44. coveralls: {
  45. command: 'node node_modules/.bin/coveralls < test/reports/lcov.info'
  46. }
  47. },
  48. watch: {
  49. files: ['<%= jshint.files %>'],
  50. tasks: ['jshint', 'simplemocha:short']
  51. }
  52. });
  53. grunt.registerTask('assets', ['exec:assets-force']);
  54. grunt.registerTask('test', ['jshint', 'exec:assets', 'simplemocha:full']);
  55. grunt.registerTask('cover', 'exec:cover');
  56. grunt.registerTask('travis', ['jshint', 'exec:assets', 'exec:cover', 'exec:coveralls']);
  57. grunt.registerTask('default', 'test');
  58. };