| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- var sauceConfig = require('./grunt/sauce')
- module.exports = function (grunt) {
- grunt.initConfig({
- version: grunt.file.readJSON('package.json').version,
- jshint: {
- options: {
- reporter: require('jshint-stylish'),
- jshintrc: true
- },
- build: {
- src: ['gruntfile.js', 'tasks/*.js']
- },
- src: {
- src: 'src/**/*.js'
- },
- test: {
- src: ['test/unit/specs/**/*.js', 'test/e2e/*.js']
- }
- },
- watch: {
- options: {
- nospawn: true
- },
- dev: {
- files: ['src/**/*.js'],
- tasks: ['dev']
- },
- test: {
- files: ['test/unit/specs/**/*.js'],
- tasks: ['build-test']
- }
- },
- karma: {
- options: {
- frameworks: ['jasmine', 'commonjs'],
- files: [
- 'test/unit/lib/jquery.js',
- 'src/**/*.js',
- 'test/unit/specs/**/*.js'
- ],
- preprocessors: {
- 'src/**/*.js': ['commonjs'],
- 'test/unit/specs/**/*.js': ['commonjs']
- },
- singleRun: true
- },
- browsers: {
- options: {
- browsers: ['Chrome', 'Firefox', 'Safari'],
- reporters: ['progress']
- }
- },
- coverage: {
- options: {
- browsers: ['PhantomJS'],
- reporters: ['progress', 'coverage'],
- preprocessors: {
- 'src/**/*.js': ['commonjs', 'coverage'],
- 'test/unit/specs/**/*.js': ['commonjs']
- },
- coverageReporter: {
- reporters: [
- { type: 'lcov' },
- { type: 'text-summary' }
- ]
- }
- }
- },
- sauce1: {
- options: sauceConfig.batch1
- },
- sauce2: {
- options: sauceConfig.batch2
- },
- sauce3: {
- options: sauceConfig.batch3
- }
- },
- coveralls: {
- options: {
- coverage_dir: 'coverage/',
- force: true
- }
- }
- })
-
- // load npm tasks
- grunt.loadNpmTasks('grunt-contrib-jshint')
- grunt.loadNpmTasks('grunt-contrib-watch')
- grunt.loadNpmTasks('grunt-karma')
- grunt.loadNpmTasks('grunt-karma-coveralls')
- // load custom tasks
- grunt.file.recurse('grunt/tasks', function (path) {
- require('./' + path)(grunt)
- })
- grunt.registerTask('unit', ['karma:browsers'])
- grunt.registerTask('cover', ['karma:coverage'])
- grunt.registerTask('test', ['unit', 'cover', 'casper'])
- grunt.registerTask('sauce', ['karma:sauce1', 'karma:sauce2', 'karma:sauce3'])
- grunt.registerTask('ci', ['jshint', 'cover', 'coveralls', 'build', 'casper', 'sauce'])
- grunt.registerTask('default', ['jshint', 'build', 'test'])
- }
|