From 734e670e817e00eaab9e17e8c8210e6134ee177b Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Mon, 30 Nov 2015 12:39:17 -0800 Subject: [PATCH] fix(specs): Remove promise usage, process.env as fn to fix node 0.10 --- build/tasks/spec-task.coffee | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/build/tasks/spec-task.coffee b/build/tasks/spec-task.coffee index c1ffe577e..413b77af2 100644 --- a/build/tasks/spec-task.coffee +++ b/build/tasks/spec-task.coffee @@ -1,7 +1,6 @@ fs = require 'fs' path = require 'path' request = require 'request' -Promise = require 'bluebird' childProcess = require 'child_process' executeTests = ({cmd, args}, grunt, done) -> @@ -16,22 +15,31 @@ executeTests = ({cmd, args}, grunt, done) -> testProc.on 'error', (err) -> grunt.log.error("Process error: #{err}") testProc.on 'exit', (exitCode, signal) -> - if exitCode is 0 then done() - else notifyOfTestError(testOutput, grunt).then -> done(false) + if exitCode is 0 + done() + else + notifyOfTestError testOutput, grunt, -> + done(false) -notifyOfTestError = (testOutput, grunt) -> new Promise (resolve, reject) -> - if (process.env("TEST_ERROR_HOOK_URL") ? "").length > 0 +notifyOfTestError = (testOutput, grunt, callback) -> + if (process.env["TEST_ERROR_HOOK_URL"] ? "").length > 0 testOutput = grunt.log.uncolor(testOutput) request.post - url: process.env("TEST_ERROR_HOOK_URL") + url: process.env["TEST_ERROR_HOOK_URL"] json: username: "Edgehill Builds" text: "Aghhh somebody broke the build. ```#{testOutput}```" - , resolve - else resolve() + , callback + else + callback() + module.exports = (grunt) -> + grunt.registerTask 'run-edgehill-specs', 'Run the specs', -> + done = @async() + executeTests({cmd: './N1.sh', args: ['--test']}, grunt, done) + grunt.registerTask 'run-spectron-specs', 'Run spectron specs', -> shellAppDir = grunt.config.get('nylasGruntConfig.shellAppDir') @@ -65,11 +73,6 @@ module.exports = (grunt) -> "APP_PATH=#{executablePath}" "APP_ARGS=" ] - executeTests cmd: npmPath, args: appArgs, grunt, (succeeded) -> + executeTests {cmd: npmPath, args: appArgs}, grunt, (succeeded) -> process.chdir('..') done(succeeded) - - - grunt.registerTask 'run-edgehill-specs', 'Run the specs', -> - done = @async() - executeTests cmd: './N1.sh', args: ['--test'], grunt, done