 sourceDirectory = (dir = ".") ->
   pkgJson(dir).component?.sourceDirectory || "src"
 
-testDirectory = (dir = ".") ->
-  pkgJson(dir).component?.testDirectory || ".test"
+testDirectory = exports.testDirectory = (dir = ".") ->
+  pkgJson(dir).component?.testDirectory or (exists("static") and ".") or ".test"
 
 testTemplate = (dir = ".") ->
   tt = pkgJson(dir).component?.testTemplate

      soFar += (if soFar then pathSep else "") + dir

discoverTests = (dir) ->
  dir ||= if isComponent() then join(testDirectory(), "static") else "static"
  return [] if not exists dir
  results = []
  t.dfs dirTree = {path: "."}, (n) ->

    port = process.env.PORT || 1335
    host = process.env.HOST || "localhost"
    components = allComponents()
    staticDirName = join testDirectory(), "static"
    return listTests(discoverTests(staticDirName), host, port) if argv.list
    commands.install()
    tests = discoverTests staticDirName
