diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 00000000..16b4e0a2 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,71 @@ +{ + "maxerr" : 50, + "bitwise" : false, + "camelcase" : false, + "curly" : false, + "eqeqeq" : false, + "forin" : false, + "freeze" : false, + "immed" : false, + "indent" : 4, + "latedef" : false, + "newcap" : false, + "noarg" : false, + "noempty" : false, + "nonbsp" : false, + "nonew" : false, + "plusplus" : false, + "quotmark" : false, + "undef" : false, + "unused" : false, + "strict" : false, + "maxparams" : false, + "maxdepth" : false, + "maxstatements" : false, + "maxcomplexity" : false, + "maxlen" : false, + "asi" : false, + "boss" : false, + "debug" : false, + "eqnull" : false, + "es5" : false, + "esnext" : false, + "moz" : false, + "evil" : false, + "expr" : false, + "funcscope" : false, + "globalstrict" : false, + "iterator" : false, + "lastsemic" : false, + "laxbreak" : false, + "laxcomma" : false, + "loopfunc" : false, + "multistr" : false, + "noyield" : false, + "notypeof" : false, + "proto" : false, + "scripturl" : false, + "shadow" : false, + "sub" : false, + "supernew" : false, + "validthis" : false, + "browser" : false, + "browserify" : false, + "couch" : false, + "devel" : false, + "dojo" : false, + "jasmine" : false, + "jquery" : false, + "mocha" : false, + "mootools" : false, + "node" : false, + "nonstandard" : false, + "prototypejs" : false, + "qunit" : false, + "rhino" : false, + "shelljs" : false, + "worker" : false, + "wsh" : false, + "yui" : false, + "globals" : {} +} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..5c20fe7e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: node_js +node_js: + - '0.10' +install: + - npm install +script: + - npm test +env: + global: + - secure: diff --git a/Gruntfile.js b/Gruntfile.js index f4129311..eadfef10 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,8 +1,9 @@ -'use strict'; var child_process = require('child_process'); var util = require('util'); module.exports = function(grunt) { + 'use strict'; + var bower = grunt.file.readJSON('bower.json'); var components = []; for (var i in bower.concat.app) { @@ -10,6 +11,7 @@ module.exports = function(grunt) { } grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), concat: { components: { src: components, @@ -77,11 +79,40 @@ module.exports = function(grunt) { 'malloc' ] } + }, + jshint: { + files: ['Gruntfile.js'], // add 'src/**/*.js', 'test/**/*.js' + options: { jshintrc: '.jshintrc' }, + }, + watch: { + files: ['<%= jshint.files %>'], + tasks: ['jshint'] + }, + connect: { + server: { + options: { + base: '.', + port: 9999 + } + } + }, + 'saucelabs-mocha': { + all: { + options: { + urls: ['http://127.0.0.1:9999/test/index.html'], + build: process.env.TRAVIS_JOB_ID, + browsers: [{ browserName: 'chrome' }], + testname: 'TextSecure-Browser Tests' + } + } + } + }); + + Object.keys(grunt.config.get('pkg').devDependencies).forEach(function(key) { + if (/^grunt(?!(-cli)?$)/.test(key)) { // ignore grunt and grunt-cli + grunt.loadNpmTasks(key); } }); - grunt.loadNpmTasks('grunt-preen'); - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-sass'); grunt.registerMultiTask('compile', 'Compile the C libraries with emscripten.', function() { var callback = this.async(); @@ -117,6 +148,9 @@ module.exports = function(grunt) { }); }); + grunt.registerTask('dev', ['connect', 'watch']); + grunt.registerTask('test', ['jshint', 'connect', 'saucelabs-mocha']); grunt.registerTask('default', ['preen', 'concat', 'sass']); grunt.registerTask('build', ['compile', 'concat:curve25519']); + }; diff --git a/package.json b/package.json index 31063afb..6d16389d 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,17 @@ "devDependencies": { "bower": "^1.3.12", "grunt": "^0.4.5", + "grunt-cli": "^0.1.13", "grunt-contrib-concat": "^0.5.0", - "grunt-contrib-jshint": "~0.10.0", + "grunt-contrib-connect": "^0.9.0", + "grunt-contrib-jshint": "^0.10.0", "grunt-contrib-sass": "^0.8.1", - "grunt-preen": "^1.0.0" + "grunt-contrib-watch": "^0.6.1", + "grunt-preen": "^1.0.0", + "grunt-saucelabs": "^8.3.3" + }, + "scripts": { + "test": "grunt test", + "lint": "grunt jshint" } }