1 module.exports = function( grunt ) {
4 function readOptionalJSON( filepath ) {
7 data = JSON.parse( stripJSONComments(
8 fs.readFileSync( filepath, { encoding: "utf8" } )
14 var fs = require( "fs" ),
15 stripJSONComments = require( "strip-json-comments" ),
16 gzip = require( "gzip-js" ),
17 srcHintOptions = readOptionalJSON( "src/.jshintrc" ),
18 newNode = !/^v0/.test( process.version ),
20 // Allow to skip jsdom-related tests in Node.js < 1.0.0
21 runJsdomTests = newNode || ( function() {
30 // The concatenated file won't pass onevar
31 // But our modules can
32 delete srcHintOptions.onevar;
35 pkg: grunt.file.readJSON( "package.json" ),
36 dst: readOptionalJSON( "dist/.destination.json" ),
38 files: [ "dist/jquery.js", "dist/jquery.min.js" ],
41 gz: function( contents ) {
42 return gzip.zip( contents, {} ).length;
45 cache: "build/.sizecache.json"
55 "test/node_smoke_tests/lib/ensure_iterability.js":
56 "test/node_smoke_tests/lib/ensure_iterability_es6.js"
62 dest: "dist/jquery.js",
68 ajax: [ "manipulation/_evalUrl", "event/ajax" ],
69 callbacks: [ "deferred" ],
70 css: [ "effects", "dimensions", "offset" ]
77 destPrefix: "external"
80 "sizzle/dist": "sizzle/dist",
81 "sizzle/LICENSE.txt": "sizzle/LICENSE.txt",
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/fake_timers.js": "sinon/lib/sinon/util/fake_timers.js",
95 "sinon/timers_ie.js": "sinon/lib/sinon/util/timers_ie.js",
96 "sinon/LICENSE.txt": "sinon/LICENSE"
102 src: [ "package.json" ]
108 "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js"
115 src: "dist/jquery.js",
116 options: srcHintOptions
121 gruntfile: "Gruntfile.js",
123 // Check parts of tests that pass
125 "test/data/testrunner.js",
126 "test/unit/basic.js",
134 // A special module with basic tests, meant for
135 // not fully supported environments like Android 2.3,
136 // jsdom or PhantomJS. We run it everywhere, though,
137 // to make sure tests are not broken.
161 files: [ "<%= jshint.all.src %>" ],
167 "dist/jquery.min.js": [ "dist/jquery.js" ]
170 preserveComments: false,
172 sourceMapName: "dist/jquery.min.map",
177 banner: "/*! jQuery v<%= pkg.version %> | " +
178 "(c) jQuery Foundation | jquery.org/license */",
189 // Load grunt tasks from NPM packages
190 require( "load-grunt-tasks" )( grunt );
192 // Integrate jQuery specific tasks
193 grunt.loadTasks( "build/tasks" );
195 grunt.registerTask( "lint", [ "jsonlint", "jshint", "jscs" ] );
197 // Don't run Node-related tests in Node.js < 1.0.0 as they require an old
198 // jsdom version that needs compiling, making it harder for people to compile
199 // jQuery on Windows. (see gh-2519)
200 grunt.registerTask( "test_fast", runJsdomTests ? [ "node_smoke_tests" ] : [] );
202 grunt.registerTask( "test", [ "test_fast" ] );
204 // Short list as a high frequency watch task
205 grunt.registerTask( "dev", [ "build:*:*", "lint", "uglify", "remove_map_comment", "dist:*" ] );
207 grunt.registerTask( "default", [ "dev", "test_fast", "compare_size" ] );