forked from alex-seville/blanket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
185 lines (180 loc) · 6.8 KB
/
Gruntfile.js
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
module.exports = function(grunt) {
'use strict';
require('load-grunt-tasks')(grunt);
var testConfig = grunt.file.readJSON("test/testconfigs.json");
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> */\n\n',
cmds: testConfig.cmds,
runners: testConfig.runners,
phantom: testConfig.phantom,
reporters: testConfig.reporters,
blanketTest: {
normal:{
node: "<%= cmds.mocha %> <%= runners.node %>",
nodeCS: "<%= cmds.mochaCS %> <%= runners.nodeCS %>",
browser: "<%= cmds.phantom %> <%= phantom.qunit %> <%= runners.browser %>",
browserBranchTracking: "<%= cmds.phantom %> <%= phantom.qunit %> <%= runners.browserBranchTracking %>",
browserRequire: "<%= cmds.phantom %> <%= phantom.qunit %> <%= runners.browserRequire %>",
browserBackbone: "<%= cmds.phantom %> <%= phantom.qunit %> <%= runners.browserBackbone %>",
browserReporter: "<%= cmds.phantom %> <%= phantom.qunit %> <%= runners.browserReporter %>",
browserJasmine: "<%= cmds.phantom %> <%= phantom.jasmine %> <%= runners.browserJasmine %>",
browserJasmineBuild: "<%= cmds.phantom %> <%= phantom.jasmine %> <%= runners.browserJasmineBuild %>",
browserJasmineAdapter: "<%= cmds.phantom %> <%= phantom.jasmine %> <%= runners.browserJasmineAdapter %>",
browserJasmineAdapterArray: "<%= cmds.phantom %> <%= phantom.jasmine %> <%= runners.browserJasmineAdapterArray %>",
browserJasmineAdapterRegex: "<%= cmds.phantom %> <%= phantom.jasmine %> <%= runners.browserJasmineAdapterRegex %>",
browserMochaAdapter: "<%= cmds.phantom %> <%= phantom.mocha %> <%= runners.browserMochaAdapter %>",
browserBootstrap: "<%= cmds.phantom %> <%= phantom.qunit_old %> <%= runners.browserBootstrap %>",
browserCoffeeScript: "<%= cmds.phantom %> <%= phantom.qunit %> <%= runners.browserCoffeeScript %>",
browserJasmineRequire: "<%= cmds.phantom %> <%= phantom.jasmine %> <%= runners.browserJasmineRequire %>",
//browserChutzpah: "<%= cmds.phantom %> <%= phantom.qunit %> <%= runners.browserChutzpah %>",
browserCommonjs: "<%= cmds.phantom %> <%= phantom.qunit %> <%= runners.browserCommonjs %>"
},
coverage:{
node: "<%= cmds.mocha %> --reporter <%= reporters.mocha.node %> <%= runners.node %>",
browser: "<%= cmds.phantom %> <%= reporters.qunit %> <%= runners.browser %> 80",
browserBranchTracking: "<%= cmds.phantom %> <%= phantom.qunit %> <%= runners.browserBranchTracking %> 80",
browserRequire: "<%= cmds.phantom %> <%= reporters.qunit %> <%= runners.browserRequire %> 80",
browserReporter: "<%= cmds.phantom %> <%= reporters.qunit %> <%= runners.browserReporter %> 80",
browserJasmine: "<%= cmds.phantom %> <%= reporters.jasmine %> <%= runners.browserJasmine %> 80",
browserJasmineBuild: "<%= cmds.phantom %> <%= reporters.jasmine %> <%= runners.browserJasmineBuild %> 80",
browserJasmineAdapter: "<%= cmds.phantom %> <%= reporters.jasmine %> <%= runners.browserJasmineAdapter %> 80",
browserMochaAdapter: "<%= cmds.phantom %> <%= reporters.mocha.browser %> <%= runners.browserMochaAdapter %> 80"
}
},
concat: {
esprima: {
options: {
banner: '(function(define){\n',
footer: '\n})(null);<%= "" %>'
},
src: ['node_modules/esprima/esprima.js'],
dest: '.tmp/esprima.js'
},
falafel: {
options: {
banner: '/*!\n' +
' * falafel (c) James Halliday / MIT License\n' +
' * https://github.com/substack/node-falafel\n' +
' */\n\n' +
'(function(require,module){\n',
footer: '\nwindow.falafel = module.exports;})(function(){return {parse: esprima.parse};},{exports: {}});'
},
src: ['node_modules/falafel/index.js'],
dest: '.tmp/falafel.js'
},
qunit: {
options: {
banner: '<%= banner %>'
},
src: [
'src/qunit/noautorun.js',
'<%= concat.esprima.dest %>',
'<%= concat.falafel.dest %>',
'src/blanket.js',
'src/blanket_browser.js',
"src/qunit/reporter.js",
"src/config.js",
"src/blanketRequire.js",
"src/qunit/qunit.js"
],
dest: 'dist/qunit/blanket.js'
},
jasmine: {
options: {
banner: '<%= banner %>'
},
src: [
'<%= concat.esprima.dest %>',
'<%= concat.falafel.dest %>',
'src/blanket.js',
'src/blanket_browser.js',
'src/qunit/reporter.js',
'src/config.js',
"src/blanketRequire.js",
"src/adapters/jasmine-blanket.js"
],
dest: 'dist/jasmine/blanket_jasmine.js'
},
mocha: {
options: {
banner: '<%= banner %>'
},
src: [
'<%= concat.esprima.dest %>',
'<%= concat.falafel.dest %>',
'src/blanket.js',
'src/blanket_browser.js',
"src/qunit/reporter.js",
"src/config.js",
"src/blanketRequire.js",
"src/adapters/mocha-blanket.js"
],
dest: 'dist/mocha/blanket_mocha.js'
}
},
uglify: {
options: {
preserveComments: require('uglify-save-license'),
beautify: {
ascii_only: true
}
},
qunit: {
src: ['dist/qunit/blanket.js'],
dest: 'dist/qunit/blanket.min.js'
},
jasmine: {
src: ['dist/jasmine/blanket_jasmine.js'],
dest: 'dist/jasmine/blanket_jasmine.min.js'
},
mocha: {
src: ['dist/mocha/blanket_mocha.js'],
dest: 'dist/mocha/blanket_mocha.min.js'
}
},
jshint: {
options: {
curly: true,
trailing: true,
eqeqeq: true,
immed: false,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: false,
boss: true,
strict:false,
eqnull: true,
node: true,
browser: true,
expr: "warn"
},
all: [
'Gruntfile.js',
'src/*.js',
'src/qunit/*.js',
'src/reporters/*.js',
'src/adapters/*.js',
'src/loaders/*.js',
'test/*.js',
'test-node/*.js'
]
},
clean: {
tmpfiles: ['./.tmp']
},
watch: {
files: '<%= jshint.all %>',
tasks: 'default'
}
});
// Load local tasks.
grunt.loadTasks('tasks');
grunt.registerTask('build',['jshint', 'concat', 'uglify', 'clean']);
grunt.registerTask('default', ['build', 'blanketTest']);
grunt.registerTask('blanket', ['build', 'blanketTest:normal']);
grunt.registerTask('blanket-coverage', ['build', 'blanketTest:coverage']);
};