Gruntfile.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. module.exports = function(grunt) {
  2. grunt.initConfig({
  3. 'shell': {
  4. 'options': {
  5. 'stdout': true,
  6. 'stderr': true,
  7. 'failOnError': true
  8. },
  9. 'generate-test-data': { // Only when needed
  10. 'command': 'if [ ! -f data.json ]; then python generate-test-data.py; fi',
  11. 'options': {
  12. 'execOptions': {
  13. 'cwd': 'tests'
  14. }
  15. }
  16. },
  17. 'cover-html': {
  18. 'command': 'istanbul cover --report "html" --verbose --dir "coverage" "tests/tests.js"; istanbul report --root "coverage" --format "html"'
  19. },
  20. 'cover-coveralls': {
  21. 'command': 'istanbul cover --verbose --dir "coverage" "tests/tests.js" && cat coverage/lcov.info | coveralls; rm -rf coverage/lcov*'
  22. },
  23. 'test-narwhal': {
  24. 'command': 'echo "Testing in Narwhal..."; export NARWHAL_OPTIMIZATION=-1; narwhal "tests/tests.js"'
  25. },
  26. 'test-phantomjs': {
  27. 'command': 'echo "Testing in PhantomJS..."; phantomjs "tests/tests.js"'
  28. },
  29. // Rhino 1.7R4 has a bug that makes it impossible to test in.
  30. // https://bugzilla.mozilla.org/show_bug.cgi?id=775566
  31. // To test, use Rhino 1.7R3, or wait (heh) for the 1.7R5 release.
  32. 'test-rhino': {
  33. 'command': 'echo "Testing in Rhino..."; rhino -opt -1 "tests.js"',
  34. 'options': {
  35. 'execOptions': {
  36. 'cwd': 'tests'
  37. }
  38. }
  39. },
  40. 'test-ringo': {
  41. 'command': 'echo "Testing in Ringo..."; ringo -o -1 "tests/tests.js"'
  42. },
  43. 'test-node': {
  44. 'command': 'echo "Testing in Node..."; node "tests/tests.js" --extended'
  45. },
  46. 'test-browser': {
  47. 'command': 'echo "Testing in a browser..."; open "tests/index.html"'
  48. }
  49. }
  50. });
  51. grunt.loadNpmTasks('grunt-shell');
  52. grunt.registerTask('cover', 'shell:cover-html');
  53. grunt.registerTask('ci', [
  54. 'shell:generate-test-data',
  55. 'shell:test-narwhal',
  56. 'shell:test-phantomjs',
  57. 'shell:test-rhino',
  58. 'shell:test-ringo',
  59. 'shell:test-node',
  60. ]);
  61. grunt.registerTask('test', [
  62. 'shell:generate-test-data',
  63. 'ci',
  64. 'shell:test-browser'
  65. ]);
  66. grunt.registerTask('default', [
  67. 'shell:test-node',
  68. 'cover'
  69. ]);
  70. };