       @emit "error"
 
 
+
   hasReadyText: ( buffer )=>
     if buffer.lastIndexOf( @testPackagesOpts()["meteor-ready-text"] ) isnt -1
       @emit "ready"
 
+
+  # TODO: Test
   kill:->
     @childProcess?.child?.kill()
 
 
 module.exports = Meteor
-

    stderr:""
  }

  # It is a function not an object because of design for testability, so we can modify process.env before each tests.
  defaultOpts: ->
    {
    "port"        : process.env.PORT || 4096
    "root-url"    : process.env.ROOT_URL || null
    "mongo-url"   : process.env.MONGO_URL || null
    "settings"    : null
    "production"  : false
    "once"        : false
    }

  runOpts:{

  }

  # See defaultOpts why it is a function an not an object.
  testPackagesOpts: ->
    {
    "app": null
    "driver-package": "test-in-console"
    "app-packages": true #TODO Add Support for testing all packages within an app that are not symlinks
    "timeout": 120000 # 2 minutes
    "meteor-ready-text": "=> App running at:"
    "meteor-error-text": "Waiting for file change."
    }


  @exec: ->

      @buffer.stderr += data
      @hasErrorText data



  @getDefaultRootUrl: ->
    log.debug "Meteor.getDefaultRootUrl()"
    port = process.env.SPACEJAM_PORT || # TODO: Remove if unnecessary
      process.env.PORT ||
      4096
    rootUrl = "http://localhost:#{port}/"
    return rootUrl



  # TODO: Test
  _globPackages: (app,packages)-> # Use glob to get packages that match the packages arg
    log.debug "Meteor._globPackages()",arguments
    expect(app,"@app should be a string").to.be.a "string"
    expect(packages,"@packages should be and array").to.be.an "array"

    matchedPackages = []

