Gruntfile.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. module.exports = function(grunt) {
  2. "use strict";
  3. grunt.initConfig({
  4. pkg: grunt.file.readJSON("package.json"),
  5. copy: {
  6. browsertest: {
  7. files: [
  8. { expand: true, cwd: 'node_modules/qunit/qunit', src: 'qunit.*' ,
  9. dest: 'test/lib'},
  10. { expand: true, cwd: 'node_modules/requirejs', src: 'require.js',
  11. dest: 'test/lib'}
  12. ],
  13. }
  14. },
  15. uglify: {
  16. all: {
  17. files: {
  18. "<%= pkg.name %>.min.js": [ "<%= pkg.name %>.js" ],
  19. "lib/alea.min.js": [ "lib/alea.js" ],
  20. "lib/tychei.min.js": [ "lib/tychei.js" ],
  21. "lib/xor4096.min.js": [ "lib/xor4096.js" ],
  22. "lib/xorshift7.min.js": [ "lib/xorshift7.js" ],
  23. "lib/xorwow.min.js": [ "lib/xorwow.js" ],
  24. "lib/xor128.min.js": [ "lib/xor128.js" ]
  25. },
  26. options: {
  27. preserveComments: false,
  28. report: "min",
  29. output: {
  30. ascii_only: true
  31. }
  32. }
  33. }
  34. },
  35. qunit: {
  36. options: {
  37. noGlobals: true,
  38. httpBase: 'http://localhost:8192'
  39. },
  40. all: ["test/*.html"]
  41. },
  42. connect: {
  43. server: {
  44. options: {
  45. port: 8192,
  46. base: '.'
  47. }
  48. }
  49. },
  50. browserify: {
  51. test: {
  52. files: {
  53. 'test/browserified.js': ['test/nodetest.js'],
  54. },
  55. options: {
  56. ignore: ['requirejs', 'process'],
  57. alias: {
  58. 'assert': './test/qunitassert.js'
  59. }
  60. }
  61. }
  62. },
  63. mocha_nyc: {
  64. coverage: {
  65. src: 'test/*test.js'
  66. },
  67. coveralls: {
  68. src: 'test/*test.js',
  69. options: {
  70. coverage: true
  71. }
  72. }
  73. },
  74. release: {
  75. options: {
  76. bump: false
  77. }
  78. }
  79. });
  80. grunt.event.on('coverage', require('coveralls').handleInput);
  81. grunt.loadNpmTasks('grunt-contrib-copy');
  82. grunt.loadNpmTasks('grunt-contrib-connect');
  83. grunt.loadNpmTasks('grunt-contrib-qunit');
  84. grunt.loadNpmTasks('grunt-contrib-uglify');
  85. grunt.loadNpmTasks('grunt-mocha-nyc');
  86. grunt.loadNpmTasks('grunt-release');
  87. grunt.loadNpmTasks('grunt-browserify');
  88. grunt.registerTask("test", ["copy:browsertest", "browserify",
  89. "connect", "qunit", "mocha_nyc:coverage"]);
  90. grunt.registerTask("default", ["uglify", "test"]);
  91. grunt.registerTask("travis", ["default", "mocha_nyc:coveralls"]);
  92. };