     else
       @opts = require("rc")("spacejam",@opts,->)
 
+    if not fs.existsSync(process.cwd() + '/.meteor/packages')
+      #log.error "Error: spacejam needs to be run from within a meteor app folder. Exiting."
+      throw new Error("spacejam needs to be run from within a meteor app folder.")
+
     expect(+@opts["port"],"--port is not a number. See 'spacejam help' for more info.").to.be.ok
 
     @opts["root-url"] ?= Meteor.getDefaultRootUrl(@opts["port"])
 
     packages = @opts._[1..] # Get packages from command line
 
-    _testPackages = null
     if packages.length > 0
-      _testPackages = @_globPackages(@opts["app"],packages)
-
-      if !_testPackages.length > 0
-        log.warn "Package not found"
-        @emit "exit",1
-        return
+      _testPackages = @_globPackages(packages)
+      expect(_testPackages).to.have.length.above 0
 
     args = [
       "--port"

      "test-packages"
    ]
    args.push(_testPackages) if _testPackages
    args.push("--production") if @opts["production"]
    args.push("--once") if @opts["once"]
    args.push(["--settings",@opts["settings"]]) if @opts["settings"]
    args.push(["--release",@opts["release"]]) if @opts["release"]
    args.push(["--deploy",@opts["deploy"]]) if @opts["deploy"]

    # Remove undefined values from args
    args = _.without(args,undefined)



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

    pkgsFolder = process.cwd() + '/packages'

    globOpts = {
      cwd: pkgsFolder
    }

    matchedPackages = []

    packages.forEach (pkgArg)=>
      if pkgArg.indexOf(':') > 0
        # It's a package name in the new format, we'll add it as is
        # TODO: Support globs for this too, by looking up package names inside package.js
        matchedPackages.push(pkgArg)
      else if pkgArg.indexOf('/') >= 0
        # It's a path to a package, we'll add it as is too
        # TODO: Support globs for this too
        matchedPackages.push(pkgArg)
      else
        # It's a package name, let's find matching package names, if it includes wildcards
        globedPackages = glob.sync(pkgArg, globOpts)
        if globedPackages.length > 0
          globedPackages.forEach (pkg)->
            matchedPackages.push(pkg)
        else
          log.warn "Warning: No packages matching #{pkgArg} have been found. Will add it to the meteor command line anyway, in case it's in PACKAGE_DIRS."
          # TODO: Support globs in PACKAGE_DIRS too.
          matchedPackages.push(pkgArg)

    return matchedPackages

