You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.8 KiB

  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 echo python generate-test-data.py; fi',
  11. 'options': {
  12. 'execOptions': {
  13. 'cwd': 'tests'
  14. }
  15. }
  16. },
  17. 'cover': {
  18. 'command': 'istanbul cover --report "html" --verbose --dir "coverage" "tests/tests.js"; istanbul report --root "coverage" --format "html"'
  19. },
  20. 'test-narwhal': {
  21. 'command': 'echo "Testing in Narwhal..."; export NARWHAL_OPTIMIZATION=-1; narwhal "tests/tests.js"'
  22. },
  23. 'test-phantomjs': {
  24. 'command': 'echo "Testing in PhantomJS..."; phantomjs "tests/tests.js"'
  25. },
  26. // Rhino 1.7R4 has a bug that makes it impossible to test in.
  27. // https://bugzilla.mozilla.org/show_bug.cgi?id=775566
  28. // To test, use Rhino 1.7R3, or wait (heh) for the 1.7R5 release.
  29. 'test-rhino': {
  30. 'command': 'echo "Testing in Rhino..."; rhino -opt -1 "tests.js"',
  31. 'options': {
  32. 'execOptions': {
  33. 'cwd': 'tests'
  34. }
  35. }
  36. },
  37. 'test-ringo': {
  38. 'command': 'echo "Testing in Ringo..."; ringo -o -1 "tests/tests.js"'
  39. },
  40. 'test-node': {
  41. 'command': 'echo "Testing in Node..."; node "tests/tests.js" --extended'
  42. },
  43. 'test-browser': {
  44. 'command': 'echo "Testing in a browser..."; open "tests/index.html"'
  45. }
  46. }
  47. });
  48. grunt.loadNpmTasks('grunt-shell');
  49. grunt.registerTask('cover', 'shell:cover');
  50. grunt.registerTask('ci', [
  51. 'shell:generate-test-data',
  52. 'shell:test-narwhal',
  53. 'shell:test-phantomjs',
  54. 'shell:test-rhino',
  55. 'shell:test-ringo',
  56. 'shell:test-node',
  57. ]);
  58. grunt.registerTask('test', [
  59. 'shell:generate-test-data',
  60. 'ci',
  61. 'shell:test-browser'
  62. ]);
  63. grunt.registerTask('default', [
  64. 'shell:test-node',
  65. 'cover'
  66. ]);
  67. };