1 module.exports = function( grunt ) {
4 function readOptionalJSON( filepath ) {
5 var stripJSONComments = require( "strip-json-comments" ),
8 data = JSON.parse( stripJSONComments(
9 fs.readFileSync( filepath, { encoding: "utf8" } )
15 var fs = require( "fs" ),
16 gzip = require( "gzip-js" ),
17 isTravis = process.env.TRAVIS;
19 if ( !grunt.option( "filename" ) ) {
20 grunt.option( "filename", "jquery.js" );
24 pkg: grunt.file.readJSON( "package.json" ),
25 dst: readOptionalJSON( "dist/.destination.json" ),
27 files: [ "dist/jquery.js", "dist/jquery.min.js" ],
30 gz: function( contents ) {
31 return gzip.zip( contents, {} ).length;
34 cache: "build/.sizecache.json"
41 plugins: [ "transform-es2015-for-of" ]
45 "test/node_smoke_tests/lib/ensure_iterability.js":
46 "test/node_smoke_tests/lib/ensure_iterability_es6.js"
52 dest: "dist/jquery.js",
58 // Exclude specified modules if the module matching the key is removed
60 ajax: [ "manipulation/_evalUrl", "event/ajax" ],
61 callbacks: [ "deferred" ],
62 css: [ "effects", "dimensions", "offset" ],
63 "css/showHide": [ "effects" ],
65 remove: [ "ajax", "effects", "queue", "core/ready" ],
66 include: [ "core/ready-no-deferred" ]
68 sizzle: [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ]
75 destPrefix: "external"
78 "sizzle/dist": "sizzle/dist",
79 "sizzle/LICENSE.txt": "sizzle/LICENSE.txt",
81 "npo/npo.js": "native-promise-only/npo.js",
83 "qunit/qunit.js": "qunitjs/qunit/qunit.js",
84 "qunit/qunit.css": "qunitjs/qunit/qunit.css",
85 "qunit/LICENSE.txt": "qunitjs/LICENSE.txt",
87 "qunit-assert-step/qunit-assert-step.js":
88 "qunit-assert-step/qunit-assert-step.js",
89 "qunit-assert-step/MIT-LICENSE.txt":
90 "qunit-assert-step/MIT-LICENSE.txt",
92 "requirejs/require.js": "requirejs/require.js",
94 "sinon/sinon.js": "sinon/pkg/sinon.js",
95 "sinon/LICENSE.txt": "sinon/LICENSE"
101 src: [ "package.json" ]
107 // See https://github.com/sindresorhus/grunt-eslint/issues/119
111 // We have to explicitly declare "src" property otherwise "newer"
112 // task wouldn't work properly :/
114 src: "dist/jquery.js"
117 src: [ "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js" ]
123 // A special module with basic tests, meant for
124 // not fully supported environments like Android 2.3,
125 // jsdom or PhantomJS. We run it everywhere, though,
126 // to make sure tests are not broken.
153 customContextFile: "test/karma.context.html",
154 customDebugFile: "test/karma.debug.html",
156 ChromeHeadlessNoSandbox: {
157 base: "ChromeHeadless",
158 flags: [ "--no-sandbox" ]
161 frameworks: [ "qunit" ],
162 middleware: [ "mockserver" ],
166 "middleware:mockserver": [
168 require( "./test/middleware-mockserver.js" )
173 "test/data/jquery-1.9.1.js",
174 "external/qunit-assert-step/qunit-assert-step.js",
175 "external/sinon/sinon.js",
176 "external/npo/npo.js",
177 "external/requirejs/require.js",
178 "test/data/testinit.js",
180 "dist/jquery.min.js",
182 // Replacement for testinit.js#loadTests()
183 "test/data/testrunner.js",
184 "test/unit/basic.js",
186 "test/unit/callbacks.js",
187 "test/unit/deferred.js",
188 "test/unit/deprecated.js",
189 "test/unit/support.js",
191 "test/unit/queue.js",
192 "test/unit/attributes.js",
193 "test/unit/event.js",
194 "test/unit/selector.js",
195 "test/unit/traversing.js",
196 "test/unit/manipulation.js",
199 "test/unit/serialize.js",
201 "test/unit/effects.js",
202 "test/unit/offset.js",
203 "test/unit/dimensions.js",
204 "test/unit/animation.js",
205 "test/unit/tween.js",
206 "test/unit/ready.js",
208 { pattern: "dist/jquery.js", included: false, served: true },
209 { pattern: "dist/*.map", included: false, served: true },
210 { pattern: "external/qunit/qunit.css", included: false, served: true },
212 pattern: "test/**/*.@(js|css|jpg|html|xml)",
217 reporters: [ "dots" ],
220 captureTimeout: 20 * 1000,
225 // The Chrome sandbox doesn't work on Travis.
226 browsers: [ isTravis ? "ChromeHeadlessNoSandbox" : "ChromeHeadless" ]
229 // To debug tests with Karma:
230 // 1. Run 'grunt karma:chrome-debug' or 'grunt karma:firefox-debug'
231 // (any karma subtask that has singleRun=false)
232 // 2. Press "Debug" in the opened browser window to start
233 // the tests. Unlike the other karma tasks, the debug task will
234 // keep the browser window open.
236 browsers: [ "Chrome" ],
240 browsers: [ "Firefox" ],
245 files: [ "<%= eslint.dev.src %>" ],
251 "dist/<%= grunt.option('filename').replace('.js', '.min.js') %>":
252 "dist/<%= grunt.option('filename') %>"
255 preserveComments: false,
258 "dist/<%= grunt.option('filename').replace('.js', '.min.map') %>",
263 // Support: Android 4.0 only
264 // UglifyJS 3 breaks Android 4.0 if this option is not enabled.
265 // This is in lieu of setting ie8 for all of mangle, compress, and output
268 banner: "/*! jQuery v<%= pkg.version %> | " +
269 "(c) JS Foundation and other contributors | jquery.org/license */",
275 // typeofs transformation is unsafe for IE9-10
276 // See https://github.com/mishoo/UglifyJS2/issues/2198
284 // Load grunt tasks from NPM packages
285 require( "load-grunt-tasks" )( grunt );
287 // Integrate jQuery specific tasks
288 grunt.loadTasks( "build/tasks" );
290 grunt.registerTask( "lint", [
293 // Running the full eslint task without breaking it down to targets
294 // would run the dist target first which would point to errors in the built
295 // file, making it harder to fix them. We want to check the built file only
296 // if we already know the source files pass the linter.
301 grunt.registerTask( "lint:newer", [
304 // Don't replace it with just the task; see the above comment.
309 grunt.registerTask( "test:fast", "node_smoke_tests" );
310 grunt.registerTask( "test:slow", "promises_aplus_tests" );
312 grunt.registerTask( "test", [
317 grunt.registerTask( "dev", [
321 "remove_map_comment",
327 grunt.registerTask( "default", [
331 "remove_map_comment",