From 37ca45ba09c81d5fbb80aff60571e20b16d3d608 Mon Sep 17 00:00:00 2001 From: Christian Roth Date: Sun, 16 Jun 2013 18:49:30 +0200 Subject: [PATCH] Change: Switched testing framework to mocha Signed-off-by: Christian Roth --- Gruntfile.coffee | 22 ++++++---------------- package.json | 7 ++++--- test/indexTest.coffee | 35 ++++++++++++----------------------- 3 files changed, 22 insertions(+), 42 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 522dc96..9d275b0 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -5,8 +5,6 @@ module.exports = (grunt) -> clean: server: src: ['app'] - test: - src: ['.test'] coffee: server: @@ -19,20 +17,12 @@ 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: @@ -40,9 +30,9 @@ module.exports = (grunt) -> 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', [ @@ -50,7 +40,7 @@ module.exports = (grunt) -> ] grunt.registerTask 'test', [ - 'clean:test', 'coffee:test', 'vows:server', 'clean:test' + 'simplemocha:server' ] grunt.registerTask 'server', [ diff --git a/package.json b/package.json index 12e5a72..77929c9 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/test/indexTest.coffee b/test/indexTest.coffee index 073c95a..a956734 100644 --- a/test/indexTest.coffee +++ b/test/indexTest.coffee @@ -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) \ No newline at end of file +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' \ No newline at end of file