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