mirror of
https://github.com/atom/atom.git
synced 2026-01-14 17:38:03 -05:00
Better error messages
This commit is contained in:
@@ -2,6 +2,7 @@ fs = require 'fs'
|
||||
path = require 'path'
|
||||
|
||||
_ = require 'underscore-plus'
|
||||
|
||||
async = require 'async'
|
||||
|
||||
module.exports = (grunt) ->
|
||||
@@ -10,7 +11,7 @@ module.exports = (grunt) ->
|
||||
packageSpecQueue = null
|
||||
|
||||
runPackageSpecs = (callback) ->
|
||||
passed = true
|
||||
failedPackages = []
|
||||
rootDir = grunt.config.get('atom.shellAppDir')
|
||||
appDir = grunt.config.get('atom.appDir')
|
||||
atomPath = path.join(appDir, 'atom.sh')
|
||||
@@ -25,9 +26,8 @@ module.exports = (grunt) ->
|
||||
env: _.extend({}, process.env, ATOM_PATH: rootDir)
|
||||
grunt.verbose.writeln "Launching #{path.basename(packagePath)} specs."
|
||||
spawn options, (error, results, code) ->
|
||||
if error
|
||||
passed = false
|
||||
grunt.log.error "#{path.basename(packagePath)} specs failed"
|
||||
|
||||
failedPackages.push path.basename(packagePath) if error
|
||||
callback()
|
||||
|
||||
modulesDirectory = path.resolve('node_modules')
|
||||
@@ -38,7 +38,7 @@ module.exports = (grunt) ->
|
||||
packageSpecQueue.push(packagePath)
|
||||
|
||||
packageSpecQueue.concurrency = 1
|
||||
packageSpecQueue.drain = -> callback(null, passed)
|
||||
packageSpecQueue.drain = -> callback(null, failedPackages)
|
||||
|
||||
runCoreSpecs = (callback) ->
|
||||
contentsDir = grunt.config.get('atom.contentsDir')
|
||||
@@ -51,14 +51,19 @@ module.exports = (grunt) ->
|
||||
args: ['--test', "--resource-path=#{resourcePath}", "--spec-directory=#{coreSpecsPath}"]
|
||||
spawn options, (error, results, code) ->
|
||||
packageSpecQueue.concurrency = 2
|
||||
callback(null, not error)
|
||||
callback(null, error)
|
||||
|
||||
grunt.registerTask 'run-specs', 'Run the specs', ->
|
||||
done = @async()
|
||||
startTime = Date.now()
|
||||
|
||||
async.parallel [runCoreSpecs, runPackageSpecs], (error, results) ->
|
||||
[coreSpecPassed, packageSpecsPassed] = results
|
||||
[coreSpecFailed, failedPackages] = results
|
||||
elapsedTime = Math.round((Date.now() - startTime) / 100) / 10
|
||||
grunt.verbose.writeln("Total spec time: #{elapsedTime}s")
|
||||
done(coreSpecPassed and packageSpecsPassed)
|
||||
failures = failedPackages
|
||||
failures.push "atom core" if coreSpecFailed
|
||||
|
||||
grunt.log.error("[Error]".red + " #{failures.join(', ')} spec(s) failed") if failures.length > 0
|
||||
|
||||
done(!coreSpecFailed and failedPackages.length == 0)
|
||||
|
||||
Reference in New Issue
Block a user