Gruntfile.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * grunt-tmod
  3. * https://github.com/jsonzhang/grunt-tmodjs
  4. *
  5. * Copyright (c) 2013 Json
  6. * Licensed under the MIT license.
  7. */
  8. 'use strict';
  9. module.exports = function(grunt) {
  10. // Project configuration.
  11. grunt.initConfig({
  12. jshint: {
  13. all: [
  14. 'Gruntfile.js',
  15. 'tasks/*.js',
  16. '<%= nodeunit.tests %>',
  17. ],
  18. options: {
  19. jshintrc: '.jshintrc',
  20. },
  21. },
  22. // Before generating any new files, remove any previously-created files.
  23. clean: {
  24. tests: ['tmp'],
  25. },
  26. // Configuration to be run (and then tested).
  27. tmod: {
  28. default_options: {
  29. options: {
  30. },
  31. files: {
  32. 'tmp/default_options': ['test/fixtures/testing', 'test/fixtures/123'],
  33. },
  34. },
  35. custom_options: {
  36. options: {
  37. separator: ': ',
  38. punctuation: ' !!!',
  39. },
  40. files: {
  41. 'tmp/custom_options': ['test/fixtures/testing', 'test/fixtures/123'],
  42. },
  43. },
  44. },
  45. // Unit tests.
  46. nodeunit: {
  47. tests: ['test/*_test.js'],
  48. },
  49. });
  50. // Actually load this plugin's task(s).
  51. grunt.loadTasks('tasks');
  52. // These plugins provide necessary tasks.
  53. grunt.loadNpmTasks('grunt-contrib-jshint');
  54. grunt.loadNpmTasks('grunt-contrib-clean');
  55. grunt.loadNpmTasks('grunt-contrib-nodeunit');
  56. // Whenever the "test" task is run, first clean the "tmp" dir, then run this
  57. // plugin's task(s), then test the result.
  58. grunt.registerTask('test', ['clean', 'tmod', 'nodeunit']);
  59. // By default, lint and run all tests.
  60. grunt.registerTask('default', ['jshint', 'test']);
  61. };