Skip to content

Commit

Permalink
added support for unit tests.
Browse files Browse the repository at this point in the history
This is a step towards #5. Now we just need to write the tests.
  • Loading branch information
Morgul committed Oct 24, 2014
1 parent d077fa3 commit 8989c0e
Show file tree
Hide file tree
Showing 5 changed files with 2,249 additions and 3 deletions.
13 changes: 11 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ module.exports = function(grunt)
}
}
},
clean: ["dist"],
karma: {
unit: {
configFile: 'karma-config.js'
}
},
watch: {
less: {
files: ['<%= project.less %>'],
Expand Down Expand Up @@ -87,10 +93,13 @@ module.exports = function(grunt)
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-clean');

// Setup the build task.
grunt.registerTask('build', ['less']);
grunt.registerTask('devel', ['connect', 'watch']);
grunt.registerTask('build', ['clean', 'less', 'copy', 'browserify']);
grunt.registerTask('test', ['build', 'karma:unit']);
grunt.registerTask('devel', ['clean', 'connect', 'watch']);
}; // module.exports

// ---------------------------------------------------------------------------------------------------------------------
25 changes: 25 additions & 0 deletions karma-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//----------------------------------------------------------------------------------------------------------------------
// Karma unit test configuration
//----------------------------------------------------------------------------------------------------------------------

module.exports = function(config)
{
config.set({
files: [
'dist/vendor/angularjs/angular.min.js',
'dist/vendor/**/*.js',

// Compiled files to be tested
'dist/js/rfi-client.js',

// Tests
'tests/**/*.spec.js'
],
frameworks: ['jasmine'],
browsers: ['Chrome'], //TODO: We probably should test in Firefox as well
reporters: ['spec'],
singleRun: true
});
}; // end module.exports

//----------------------------------------------------------------------------------------------------------------------
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@
"devDependencies": {
"grunt": "^0.4.5",
"grunt-browserify": "^3.0.1",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-connect": "^0.8.0",
"grunt-contrib-copy": "^0.6.0",
"grunt-contrib-less": "^0.11.4",
"grunt-contrib-watch": "^0.6.1"
"grunt-contrib-watch": "^0.6.1",
"grunt-karma": "^0.9.0",
"karma": "^0.12.24",
"karma-chrome-launcher": "^0.1.5",
"karma-jasmine": "^0.1.5",
"karma-spec-reporter": "0.0.13"
}
}
Loading

0 comments on commit 8989c0e

Please sign in to comment.