module.exports = function(grunt) { grunt.initConfig({ jshint: { options: { trailing: true }, target: { src : [ 'converse.js', 'mock.js', 'main.js', 'tests_main.js', 'spec/*.js' ] } } }); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.registerTask('test', 'Run Tests', function () { var done = this.async(); var child_process = require('child_process'); var exec = child_process.exec; exec('phantomjs '+ 'node_modules/jasmine-reporters/test/phantomjs-testrunner.js '+ __dirname+'/tests.html', function (err, stdout, stderr) { if (err) { grunt.log.write('Tests failed with error code '+err.code); grunt.log.write(stderr); } grunt.log.write(stdout); done(); }); }); grunt.registerTask('default', 'Perform all checks (e.g. before releasing)', function () { grunt.task.run('jshint', 'test'); }); };