 
     s3Client = prepareS3()
     if s3Client
-      Promise.all([runEmailIntegrationTest(), uploadDMGToS3(s3Client), uploadZipToS3(s3Client)])
-      .then ->
-        done()
-      .catch (err) ->
-        grunt.log.error(err)
-        return false
+      runEmailIntegrationTest().then ->
+        Promise.all([uploadDMGToS3(s3Client), uploadZipToS3(s3Client)])
+        .then ->
+          done()
+        .catch (err) ->
+          grunt.log.error(err)
+          return false
     else
       return false

          write(">> Uploading #{destName} #{pc}%")
      uploader.on "end", (data) ->
        resolve(data)

  getVersion = ->
    {version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json'))
    return version

  uploadDMGToS3 = (s3Client) ->
    destName = "#{process.platform}/Edgehill_#{getVersion()}.dmg"


module.exports = (grunt) ->
  {cp, spawn, rm} = require('./task-helpers')(grunt)

  getVersion = ->
    {version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json'))
    return version

  appName = -> grunt.config.get('atom.appName')
  dmgName = -> "#{appName().split('.')[0]}.dmg"
