           error: e.toString()
         }
   console.log('\tDONE')
+  # Print test failures if any
   failures.map (failure) ->
     console.log "=============================================="
     console.log "Failure (Test suit: `#{failure.suit.file}`, Test case: `#{failure.case.desc}`)"
     console.log failure.error
-
+  # Print summary
   console.log "=============================================="
   console.log "Total: #{caseCount} / Failure: #{failures.length}"
   phantom.exit failures.length

fs = require 'fs'
system = require 'system'

runTests = ->
  logger.info "Start running all tests..."
  caseCount = 0
  suits = fs.list(fs.absolute("#{phantom.libraryPath}/tests/")).filter((v) ->
    v[0] != '.'
  ).map (file) ->

    delete window.test
    return suit
  logger.info "#{suits.length} test files loaded, total #{caseCount} test cases."
  # Run all test cases
  failures = []
  suits.map (test_suit) ->
    test_suit.cases.map (test_case) ->
      try
        test_case.func()
        system.stdout.write('.')
