Gruntfile.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. module.exports = function(grunt) {
  2. grunt.initConfig({
  3. 'meta': {
  4. 'testFile': 'tests/tests.js'
  5. },
  6. 'uglify': {
  7. 'dist': {
  8. 'options': {
  9. 'report': 'gzip',
  10. 'preserveComments': 'some'
  11. },
  12. 'files': {
  13. 'punycode.min.js': ['punycode.js']
  14. }
  15. }
  16. },
  17. // 'esmangle': {
  18. // 'dist': {
  19. // 'options': {
  20. // 'banner': require('fs').readFileSync('punycode.js', 'utf8').split('\n')[0] + '\n;'
  21. // },
  22. // 'files': {
  23. // 'punycode.min.js': ['punycode.js']
  24. // }
  25. // }
  26. // },
  27. 'shell': {
  28. 'options': {
  29. 'stdout': true,
  30. 'stderr': true,
  31. 'failOnError': true
  32. },
  33. 'cover-html': {
  34. 'command': 'istanbul cover --report "html" --verbose --dir "coverage" "tests/tests.js"'
  35. },
  36. 'cover-coveralls': {
  37. 'command': 'istanbul cover --verbose --dir "coverage" "tests/tests.js" && coveralls < coverage/lcov.info; rm -rf coverage/lcov*'
  38. },
  39. 'test-narwhal': {
  40. 'command': 'echo "Testing in Narwhal..."; export NARWHAL_OPTIMIZATION=-1; narwhal "tests/tests.js"'
  41. },
  42. 'test-phantomjs': {
  43. 'command': 'echo "Testing in PhantomJS..."; phantomjs "tests/tests.js"'
  44. },
  45. 'test-rhino': {
  46. 'command': 'echo "Testing in Rhino..."; rhino -opt -1 "tests.js"',
  47. 'options': {
  48. 'execOptions': {
  49. 'cwd': 'tests'
  50. }
  51. }
  52. },
  53. 'test-ringo': {
  54. 'command': 'echo "Testing in Ringo..."; ringo -o -1 "tests/tests.js"'
  55. },
  56. 'test-node': {
  57. 'command': 'echo "Testing in Node..."; node "tests/tests.js"'
  58. },
  59. 'test-browser': {
  60. 'command': 'echo "Testing in a browser..."; open "tests/index.html"'
  61. }
  62. }
  63. });
  64. grunt.loadNpmTasks('grunt-shell');
  65. grunt.loadNpmTasks('grunt-contrib-uglify');
  66. //grunt.loadNpmTasks('grunt-esmangle');
  67. grunt.registerTask('cover', 'shell:cover-html');
  68. grunt.registerTask('ci', [
  69. 'shell:test-narwhal',
  70. 'shell:test-phantomjs',
  71. 'shell:test-rhino',
  72. 'shell:test-ringo',
  73. 'shell:test-node'
  74. ]);
  75. grunt.registerTask('test', [
  76. 'ci',
  77. 'shell:test-browser'
  78. ]);
  79. grunt.registerTask('default', [
  80. 'uglify',
  81. 'shell:test-node'
  82. ]);
  83. };