Skip to content

Instantly share code, notes, and snippets.

@winsonwq
Created October 15, 2013 00:56
Show Gist options
  • Save winsonwq/6984905 to your computer and use it in GitHub Desktop.
Save winsonwq/6984905 to your computer and use it in GitHub Desktop.
template with mocha & node in grunt
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
mochacli: {
options: {
reporter: 'spec'
},
all: {
src: ['test/build/*.js']
}
},
fileConfig: {
gruntfile: {
src: 'Gruntfile.js'
},
lib: {
src: ['lib/**/*.js']
},
test: {
src: 'test/src/**/*.coffee'
},
source: {
src: 'source/**/*.coffee'
}
},
coffee: {
sourceToLib: {
expand: true,
flatten: true,
cwd: 'source',
src: ['*.coffee'],
dest: 'lib',
ext: '.js'
},
testSourceToBuild: {
expand: true,
flatten: true,
cwd: 'test/src',
src: ['*.coffee'],
dest: 'test/build',
ext: '.js'
}
},
watch: {
test: {
files: ['<%= fileConfig.test.src %>', '<%= fileConfig.source.src%>'],
tasks: ['coffee', 'mochacli']
},
},
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha-cli');
// Default task.
grunt.registerTask('test', ['mochacli']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment