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