Skip to content

Instantly share code, notes, and snippets.

@wsimmerson
Created July 30, 2014 15:39
Show Gist options
  • Save wsimmerson/3ec35cfc771a262f9409 to your computer and use it in GitHub Desktop.
Save wsimmerson/3ec35cfc771a262f9409 to your computer and use it in GitHub Desktop.
Basic JavaScript Environment for Automated Testing
var app = function() {
return "Hello World";
};
module.exports = app;
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']);
};
{
"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"
}
}
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