Created
July 30, 2014 15:39
-
-
Save wsimmerson/3ec35cfc771a262f9409 to your computer and use it in GitHub Desktop.
Basic JavaScript Environment for Automated Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = function() { | |
return "Hello World"; | |
}; | |
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
mochaTest : { | |
test : { | |
options : { | |
reporter : 'spec', | |
clearRequireCache : true | |
}, | |
src : ['tests/**/*.spec.js'] | |
} | |
}, | |
jshint : { | |
files : ['gruntfile.js', '*.js', 'tests/*.spec.js'] | |
}, | |
watch : { | |
js : { | |
options : { | |
spawn: true, | |
interrupt: true, | |
debounceDelay: 250, | |
}, | |
files : ['gruntfile.js', '*.js', 'tests/*.spec.js'], | |
tasks : ['jshint', 'mochaTest'] | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-mocha-test'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.registerTask('default', ['jshint', 'mochaTest']); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "basic-set-up", | |
"description": "A basic JavaScript environment with automated testing", | |
"author" : "Wayne Simmerson <[email protected]>", | |
"version": "0.0.1", | |
"repository" : { | |
"type" : "git", | |
"url" : "https://github.com/wsimmerson/BasicJavaScriptSetup" | |
}, | |
"devDependencies": { | |
"chai": "^1.9.1", | |
"grunt": "^0.4.5", | |
"grunt-cli": "^0.1.13", | |
"grunt-contrib-jshint": "^0.10.0", | |
"grunt-contrib-watch": "^0.6.1", | |
"grunt-mocha-test": "^0.11.0", | |
"mocha": "^1.21.3" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var should = require('chai').should(), | |
app = require('../app'); | |
describe('app.js', function() { | |
it('should return "Hello World"', function() { | |
app().should.equal("Hello World"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment