 path = require 'path'
 
 _ = require 'underscore-plus'
-
 async = require 'async'
 
 module.exports = (grunt) ->


  packageSpecQueue = null

  runPackageSpecs = (callback) ->
    failedPackages = []
    rootDir = grunt.config.get('atom.shellAppDir')
    contentsDir = grunt.config.get('atom.contentsDir')
    resourcePath = process.cwd()
    if process.platform is 'darwin'
      appPath = path.join(contentsDir, 'MacOS', 'Atom')
    else if process.platform is 'win32'
      appPath = path.join(contentsDir, 'atom.exe')

    packageSpecQueue = async.queue (packagePath, callback) ->
      if process.platform is 'darwin'
        options =
          cmd: appPath
          args: ['--test', "--resource-path=#{resourcePath}", "--spec-directory=#{path.join(packagePath, 'spec')}"]


    # TODO: This should really be parallel on both platforms, however our
    # fixtures step on each others toes currently.
    if process.platform in ['darwin', 'linux']
      method = async.parallel
    else if process.platform is 'win32'
      method = async.series
