Permalink
Browse files

changed test system to mocha

  • Loading branch information...
1 parent 8a895ca commit 7e36141d9825e3bcb4fba2e2da5950cf483750cd @russellmcc committed Jan 20, 2014
Showing with 133 additions and 113 deletions.
  1. +4 −2 .travis.yml
  2. +18 −11 Cakefile
  3. +13 −2 package.json
  4. +98 −98 test/test-osc-utilities.coffee
View
@@ -1,4 +1,6 @@
language: node_js
node_js:
- - 0.6
- - 0.8
+ - 0.8
+ - 0.10
+after_script:
+ - npm run-script coveralls
View
@@ -3,21 +3,28 @@ child = require 'child_process'
task 'test', 'run tests (requires development install)', (options) ->
process.env['NODE_PATH'] = './lib/:$NODE_PATH'
- test = child.spawn 'expresso', ['test']
+ test = child.spawn 'mocha', ['--compilers', 'coffee:coffee-script', '-u', 'tdd', 'test']
test.stdout.pipe process.stdout
test.stderr.pipe process.stderr
+spawnMochaCov = (reporter) ->
+ return child.spawn 'mocha', ['--compilers', 'coffee:coffee-script', '-r', 'blanket', '-R', reporter, '-u', 'tdd', 'test']
+
task 'coverage', 'run tests with coverage check (requires development install)', (options) ->
- child.exec 'coffee -c lib', ->
- process.env['NODE_PATH'] = './lib/:$NODE_PATH'
- child.exec 'node-jscoverage lib lib-cov', ->
- test = child.spawn 'expresso', ['test']
- test.stdout.pipe process.stdout
- test.stderr.pipe process.stderr
- test.on "exit", () ->
- child.exec "ls lib/*.coffee", (error, output) ->
- output = output.replace /\.coffee/g, ".js"
- child.exec "rm -rf lib-cov " + output
+ process.env['NODE_PATH'] = './lib/:$NODE_PATH'
+ test = spawnMochaCov 'html-cov'
+ file = fs.createWriteStream 'coverage.html'
+ test.stdout.pipe file
+ test.stderr.pipe process.stderr
+ test.on 'exit', (num) ->
+ child.exec 'open ./coverage.html'
+
+task 'coveralls', 'report coveralls to travis', (options) ->
+ process.env['NODE_PATH'] = './lib/:$NODE_PATH'
+ test = spawnMochaCov 'mocha-lcov-reporter'
+ report = child.spawn './node_modules/coveralls/bin/coveralls.js'
+ test.stdout.pipe report.stdin
+ test.stderr.pipe process.stderr
task 'doc', 'create md and html doc files', (options) ->
child.exec 'coffee -b -c examples/*', ->
View
@@ -23,8 +23,18 @@
"coffee-script": ">=1.3.0"
},
"devDependencies": {
- "expresso": "*",
- "docket": ">=0.0.3"
+ "mocha": "*",
+ "docket": ">=0.0.3",
+ "coveralls": "*",
+ "blanket": "*",
+ "mocha-lcov-reporter": "*"
+ },
+ "config" : {
+ "blanket": {
+ "loader" : "./node-loaders/coffee-script",
+ "pattern" : "lib",
+ "data-cover-never": "node_modules"
+ }
},
"directories": {
"lib": "lib",
@@ -36,6 +46,7 @@
"scripts": {
"test": "cake test",
"coverage": "cake coverage",
+ "coveralls": "cake coveralls",
"doc": "cake doc"
},
"_id": "osc-min@0.0.5",
Oops, something went wrong.

0 comments on commit 7e36141

Please sign in to comment.