3 module.exports = function (grunt) {
5 // Project configuration.
8 pkg: grunt.file.readJSON('package.json'),
9 banner: '/*! <%= pkg.name %> - v<%= pkg.version %>' +
10 ' - <%= pkg.homepage %>' +
11 ' - (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>' +
12 ' - licensed <%= pkg.license %> */\n',
13 // Task configuration.
16 banner: '<%= banner %>',
20 src: ['lib/<%= pkg.name %>.js'],
21 dest: 'dist/<%= pkg.name %>.js'
26 banner: '<%= banner %>'
29 src: '<%= concat.dist.dest %>',
30 dest: 'dist/<%= pkg.name %>.min.js'
37 specs: 'test/*-test.js',
38 vendor: 'test/vendor/*.js',
39 helpers: 'test/*-helper.js',
40 template: require('grunt-template-jasmine-requirejs')
46 specs: 'test/global-integration.js',
47 vendor: 'test/vendor/*.js'
51 src: 'test/test-context-using-apply.generated.js',
53 specs: 'test/global-integration-with-new-context.js',
54 vendor: 'test/vendor/*.js'
60 specs: 'test/*-test.js',
61 vendor: 'test/vendor/*.js',
62 helpers: 'test/*-helper.js',
63 template: require('grunt-template-jasmine-istanbul'),
65 coverage: 'coverage/coverage.json',
81 template: require('grunt-template-jasmine-requirejs'),
85 "lib": '.grunt/grunt-contrib-jasmine/lib/'
96 match: "node-integration.",
98 projectRoot: "./test",
104 src: 'coverage/lcov.info'
108 path: 'http://127.0.0.1:8000/_SpecRunner.html'
117 'saucelabs-jasmine': {
118 // Requires valid SAUCE_USERNAME and SAUCE_ACCESS_KEY in env to run.
121 urls: ['http://localhost:8000/_SpecRunner.html'],
123 {"browserName": "firefox", "platform": "Windows 2003", "version": "3.6"},
124 {"browserName": "firefox", "platform": "Windows 2003", "version": "4"},
125 {"browserName": "firefox", "platform": "Windows 2003", "version": "25"},
126 {"browserName": "safari", "platform": "Mac 10.6", "version": "5"},
127 {"browserName": "safari", "platform": "Mac 10.8", "version": "6"},
128 {"browserName": "googlechrome", "platform": "Windows 7"},
129 {"browserName": "opera", "platform": "Windows 2003", "version": "12"},
130 // Disabled because old IE breaks the Jasmine runner; these have to be manually tested
131 // {"browserName": "iehta", "platform": "Windows XP", "version": "6"},
132 // {"browserName": "iehta", "platform": "Windows XP", "version": "7"},
133 // {"browserName": "iehta", "platform": "Windows XP", "version": "8"},
134 {"browserName": "iehta", "platform": "Windows 7", "version": "9"},
135 {"browserName": "iehta", "platform": "Windows 7", "version": "10"},
136 {"browserName": "opera", "platform": "Windows 7", "version": "12"},
137 {"browserName": "android", "platform": "Linux", "version": "4.0"},
138 {"browserName": "iphone", "platform": "OS X 10.8", "version": "6"}
144 testReadyTimeout:2000,
145 testname: 'loglevel jasmine test',
146 tags: [process.env.TRAVIS_REPO_SLUG || "local", process.env.TRAVIS_COMMIT || "manual"]
152 jshintrc: '.jshintrc'
159 jshintrc: 'lib/.jshintrc'
165 jshintrc: 'test/.jshintrc'
167 src: ['test/*.js', '!test/*.generated.js']
172 files: '<%= jshint.gruntfile.src %>',
173 tasks: ['jshint:gruntfile']
176 files: '<%= jshint.lib.src %>',
177 tasks: ['jshint:lib', 'test']
180 files: '<%= jshint.test.src %>',
181 tasks: ['jshint:test', 'test']
185 all: ['test/*-qunit.html']
188 "test-context-using-apply": {
189 src: 'test/test-context-using-apply.js',
190 dest: 'test/test-context-using-apply.generated.js'
194 test:['test/test-context-using-apply.generated.js']
198 // These plugins provide necessary tasks.
199 grunt.loadNpmTasks('grunt-contrib-concat');
200 grunt.loadNpmTasks('grunt-contrib-uglify');
201 grunt.loadNpmTasks('grunt-contrib-jasmine');
202 grunt.loadNpmTasks('grunt-coveralls');
203 grunt.loadNpmTasks('grunt-jasmine-node');
204 grunt.loadNpmTasks('grunt-contrib-jshint');
205 grunt.loadNpmTasks('grunt-contrib-watch');
206 grunt.loadNpmTasks('grunt-contrib-qunit');
208 grunt.loadNpmTasks('grunt-contrib-connect');
209 grunt.loadNpmTasks('grunt-open');
210 grunt.loadNpmTasks('grunt-saucelabs');
211 grunt.loadNpmTasks('grunt-preprocess');
212 grunt.loadNpmTasks('grunt-contrib-clean');
214 // Build a distributable release
215 grunt.registerTask('dist', ['test', 'concat', 'uglify']);
217 // Check everything is good
218 grunt.registerTask('test', ['jshint', 'jasmine:requirejs', 'jasmine:global', 'preprocess', 'jasmine:context', 'clean:test', 'jasmine_node', 'jasmine:withCoverage', 'qunit']);
220 // Test with a live server and an actual browser
221 grunt.registerTask('integration-test', ['jasmine:requirejs:src:build', 'open:jasmine', 'connect:test:keepalive']);
223 // Test with lots of browsers on saucelabs. Requires valid SAUCE_USERNAME and SAUCE_ACCESS_KEY in env to run.
224 grunt.registerTask('saucelabs', ['jasmine:requirejs:src:build', 'connect:test', 'saucelabs-jasmine']);
227 grunt.registerTask('default', 'test');
228 grunt.registerTask('ci', ['test', 'coveralls']);