Skip to content

Commit

Permalink
Use grunt + .jshint to run coding standards tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydwatkin committed Dec 12, 2013
1 parent 5a49a69 commit ee4ba98
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 17 deletions.
47 changes: 32 additions & 15 deletions .jshintrc
@@ -1,17 +1,34 @@
{
"asi": true,
"camelcase": true,
"noempty": true,
"undef": true,
"unused": true,
"trailing": true,
"maxlen": 90,
"laxcomma": true,
"newcap": true,
"quotmark": true,
"trailing": true,
"predef": [
"console", "define", "module", "require",
"before", "beforeEach", "describe", "it"
"asi": true,
"camelcase": true,
"eqeqeq": true,
"eqnull": true,
"globalstrict": true,
"immed": true,
"indent": 4,
"latedef": "nofunc",
"laxcomma": true,
"maxparams": 4,
"maxdepth": 3,
"maxstatements": 20,
"maxcomplexity": 12,
"maxlen": 120,
"newcap": true,
"noarg": true,
"noempty": true,
"nonew": true,
"quotmark": "single",
"undef": true,
"unused": true,
"strict": true,
"trailing": true,

"node": true,

"predef": [
"define", "module", "require",
"before", "beforeEach", "describe", "it",
"after", "window"
]
}

}
29 changes: 29 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,29 @@
'use strict';

module.exports = function(grunt) {

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
allFiles: ['Gruntfile.js', 'lib/**/*.js', 'tests/**/*.js', 'index.js'],
options: {
jshintrc: '.jshintrc',
}
},
mochacli: {
all: ['test/**/*.js'],
options: {
reporter: 'spec',
ui: 'tdd'
}
}
})

// Load the plugins
grunt.loadNpmTasks('grunt-contrib-jshint')
grunt.loadNpmTasks('grunt-mocha-cli')

// Configure tasks
grunt.registerTask('default', ['test'])
grunt.registerTask('test', ['mochacli', 'jshint'])
}
7 changes: 5 additions & 2 deletions package.json
Expand Up @@ -7,7 +7,7 @@
"test": "test"
},
"scripts": {
"test": "./node_modules/.bin/mocha -R spec --recursive ./test/lib"
"test": "grunt test"
},
"repository": {
"type": "git",
Expand All @@ -33,7 +33,10 @@
"devDependencies": {
"mocha": "~1.8.1",
"should": "~1.2.2",
"xmpp-ftw": "*"
"xmpp-ftw": "*",
"grunt-mocha-cli": "~1.4.0",
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.7.2"
},
"peerDependencies": {
"xmpp-ftw": "0.x"
Expand Down

0 comments on commit ee4ba98

Please sign in to comment.