Refactoring tests and moving code to common module
1. All tests have been converted into regular command-line mocha tests (instead of running in the browser), and the deployment script has been changed to automatically fail any `--new` deployment which doesn't pass. 2. Several small class (e.g., `Logger`) have been moved into a common module, `crafting-guide-common` so that they may be shared between the client and server.
This commit is contained in:
+22
-16
@@ -5,6 +5,8 @@
|
||||
# All rights reserved.
|
||||
###
|
||||
|
||||
fs = require 'fs'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
module.exports = (grunt)->
|
||||
@@ -23,15 +25,6 @@ module.exports = (grunt)->
|
||||
files:
|
||||
'./dist/js/main.js': ['./src/coffee/main.coffee']
|
||||
|
||||
test:
|
||||
options:
|
||||
transform: ['coffeeify']
|
||||
browserifyOptions:
|
||||
debug: true
|
||||
extensions: ['.coffee']
|
||||
files:
|
||||
'./dist/js/test.js': ['./src/coffee/test/test.coffee']
|
||||
|
||||
markdown:
|
||||
options:
|
||||
browserifyOptions:
|
||||
@@ -74,9 +67,6 @@ module.exports = (grunt)->
|
||||
main:
|
||||
files:
|
||||
'./dist/js/main.js.map': ['./dist/js/main.js']
|
||||
test:
|
||||
files:
|
||||
'./dist/js/test.js.map': ['./dist/js/test.js']
|
||||
|
||||
jade:
|
||||
pages:
|
||||
@@ -103,6 +93,18 @@ module.exports = (grunt)->
|
||||
files:
|
||||
'./src/coffee/views.js': ['./src/jade/templates/**/*.jade']
|
||||
|
||||
mochaTest:
|
||||
options:
|
||||
bail: true
|
||||
color: true
|
||||
reporter: 'list'
|
||||
require: [
|
||||
'coffee-script/register'
|
||||
'./test/test_helper.coffee'
|
||||
]
|
||||
verbose: true
|
||||
src: './test/**/*.test.coffee'
|
||||
|
||||
rsync:
|
||||
static:
|
||||
options:
|
||||
@@ -151,14 +153,18 @@ module.exports = (grunt)->
|
||||
sass:
|
||||
files: ['./src/**/*.scss']
|
||||
tasks: ['sass', 'copy:styles']
|
||||
tests:
|
||||
files: ['./src/**/*.coffee', './test/**/*.coffee']
|
||||
tasks: ['browserify:test']
|
||||
|
||||
grunt.registerTask 'default', 'build'
|
||||
|
||||
grunt.registerTask 'build', [ 'rsync:non_html', 'copy', 'sass:build', 'jade', 'browserify', 'exorcise' ]
|
||||
|
||||
grunt.registerTask 'dist', ['clean', 'build', 'rsync:static', 'sass:dist', 'uglify']
|
||||
grunt.registerTask 'dist', ['test', 'clean', 'build', 'rsync:static', 'sass:dist', 'uglify']
|
||||
|
||||
grunt.registerTask 'clean-watch', ['clean', 'build', 'watch']
|
||||
|
||||
grunt.registerTask 'link-deps', ->
|
||||
grunt.file.mkdir './node_modules'
|
||||
fs.unlinkSync './node_modules/crafting-guide-common'
|
||||
fs.symlinkSync '../../crafting-guide-common/', './node_modules/crafting-guide-common'
|
||||
|
||||
grunt.registerTask 'test', ['mochaTest']
|
||||
|
||||
Reference in New Issue
Block a user