Skip to content

Commit

Permalink
Change: Switched testing framework to mocha
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Roth <christian.roth@port17.de>
  • Loading branch information
cr0 committed Jun 16, 2013
1 parent 0b4cd5b commit 37ca45b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 42 deletions.
22 changes: 6 additions & 16 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ module.exports = (grunt) ->
clean:
server:
src: ['app']
test:
src: ['.test']

coffee:
server:
Expand All @@ -19,38 +17,30 @@ module.exports = (grunt) ->
dest: 'app'
ext: '.js'
]
test:
files: [
expand: true
cwd: 'test/'
src: ['**/*.coffee']
dest: '.test'
ext: '.js'
]

vows:
simplemocha:
server:
options:
reporter: 'spec'
src: ['.test/*.js']
reporter: 'Spec'
src: ['test/**/*.coffee']

watch:
coffee:
files: ['**/*.coffee']
tasks: 'coffee'


grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-vows'
grunt.loadNpmTasks 'grunt-simple-mocha'
grunt.loadNpmTasks 'grunt-contrib-watch'

grunt.registerTask 'build', [
'clean:server', 'coffee:server'
]

grunt.registerTask 'test', [
'clean:test', 'coffee:test', 'vows:server', 'clean:test'
'simplemocha:server'
]

grunt.registerTask 'server', [
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@
"grunt": "0.4.x",
"grunt-cli": "0.1.x",
"grunt-contrib-coffee": "0.7.x",
"grunt-contrib-clean": "~0.4.1"
"grunt-contrib-clean": "0.4.x"
},
"devDependencies": {
"grunt-contrib-watch": "0.4.x",
"grunt-vows": "~0.4.x",
"vows": "0.7.x"
"mocha": "1.11.x",
"grunt-simple-mocha": "0.4.x",
"chai": "1.6.x"
}
}
35 changes: 12 additions & 23 deletions test/indexTest.coffee
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
vows = require 'vows'
assert = require 'assert'

vows
.describe('Division by zero')
.addBatch
'when dividing a number by zero':
topic: -> 42/ 0

'we get Infinity': (topic) ->
assert.equal topic, Infinity

'but when dividing zero by zero':
topic: -> 0 / 0

'we get a value which':
'is not a number': (topic) ->
assert.isNaN topic

'is not equal to itself': (topic) ->
assert.notEqual topic, topic

.export(module)
chai = require 'chai'
expect = chai.expect
chai.should()


describe 'Foo', ->
it 'test equals test string', ->
'test'.should.equal 'test'
it 'bla equals bla string', ->
'bla'.should.equal 'bla'
it 'foo equals foo string', ->
'foo'.should.equal 'foo'

0 comments on commit 37ca45b

Please sign in to comment.