cake test: count number of complete tests that pass, not assertions

This commit is contained in:
Michael Ficarra 2011-11-05 11:12:50 -04:00
parent 1c86aee7a4
commit 683b3afbc1
1 changed files with 2 additions and 10 deletions

View File

@ -161,16 +161,7 @@ runTests = (CoffeeScript) ->
passedTests = 0
failures = []
# Make "global" reference available to tests
global.global = global
# Mix in the assert module globally, to make it available for tests.
addGlobal = (name, func) ->
global[name] = ->
passedTests += 1
func arguments...
addGlobal name, func for name, func of require 'assert'
global[name] = func for name, func of require 'assert'
# Convenience aliases.
global.eq = global.strictEqual
@ -181,6 +172,7 @@ runTests = (CoffeeScript) ->
try
fn.test = {description, currentFile}
fn.call(fn)
++passedTests
catch e
e.description = description if description?
e.source = fn.toString() if fn.toString?