fire-up
Version:
Fire Up! is a dependency injection container designed specifically for node.js with a powerful but sleek API.
96 lines (88 loc) • 3.08 kB
JavaScript
'use strict';
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
run: {
jasmine_node_with_coverage: {
cmd: 'node_modules/.bin/grunt',
args: ['jasmine_node_with_coverage']
},
jasmine_node_with_coverage_quiet: {
cmd: 'node_modules/.bin/grunt',
args: ['jasmine_node_with_coverage'],
options: {
quiet: true
}
}
},
clean: {
all: 'coverage'
},
jshint: {
all: [
'Gruntfile.js',
'test/**/*.js',
'lib/**/*.js',
'example/**/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
jasmine_node_no_coverage: {
coverage: false,
options: {
matchall: true,
specFolders: ['test/spec/'],
isVerbose: true
}
},
jasmine_node_with_coverage: {
coverage: {
excludes: ['test/**', 'coverage/**', 'Gruntfile.js', 'example/**']
},
options: {
matchall: true,
specFolders: ['test/spec/'],
isVerbose: true
}
},
coveralls: {
all: {
src: './coverage/lcov.info'
}
},
watch: {
js: {
files: ['**/*.js', '!node_modules/**/*.js', '!coverage/**/*.js'],
tasks: ['default'],
options: {
spawn: true // Since livereload seems not to be working we spawn to require the latest index.js
}
}
}
});
grunt.loadNpmTasks('grunt-run');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jasmine-node-coverage');
grunt.loadNpmTasks('grunt-coveralls');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('jasmine_node_no_coverage', 'Just unit testing', function () {
grunt.config.set('jasmine_node', grunt.config.get('jasmine_node_no_coverage'));
grunt.task.run('jasmine_node');
});
grunt.registerTask('jasmine_node_with_coverage', 'Unit testing with coverage report', function () {
grunt.config.set('jasmine_node', grunt.config.get('jasmine_node_with_coverage'));
grunt.task.run('jasmine_node');
});
// 'jasmine-node' needs to run in a separate task because the coverage report is created when grunt exits.
// When we use watch grunt keeps running and no report would be generated if 'jasmine-node' would be executed directly.
grunt.registerTask('test', ['clean', 'jshint', 'run:jasmine_node_with_coverage', 'watch']);
grunt.registerTask('test_no_coverage', ['clean', 'jshint', 'jasmine_node_no_coverage', 'watch']);
// 'jasmine-node' needs to run in a separate task the second time it is executed so that es-sequence freshly required.
// The unit tests assume that es-sequence is not initialized in the beginning.
grunt.registerTask('ci', ['clean', 'jshint', 'jasmine_node_no_coverage', 'run:jasmine_node_with_coverage_quiet', 'coveralls']);
grunt.registerTask('ci_no_coverage', ['clean', 'jshint', 'jasmine_node_no_coverage']);
grunt.registerTask('default', ['test']);
};