Run core and package specs in parallel

This commit is contained in:
Kevin Sawicki 2013-10-11 11:36:26 -07:00
parent 118625f002
commit 8ecc353999
2 changed files with 21 additions and 15 deletions

View File

@ -160,15 +160,6 @@ module.exports = (grunt) ->
stderr: false
failOnError: false
test:
command: "#{path.join(contentsDir, 'MacOS', 'Atom')} --test --resource-path=#{__dirname}"
options:
stdout: true
stderr: true
callback: (error, stdout, stderr, callback) ->
grunt.warn('Specs failed') if error?
callback()
grunt.loadNpmTasks('grunt-coffeelint')
grunt.loadNpmTasks('grunt-lesslint')
grunt.loadNpmTasks('grunt-cson')
@ -181,7 +172,7 @@ module.exports = (grunt) ->
grunt.registerTask('compile', ['coffee', 'prebuild-less', 'cson'])
grunt.registerTask('lint', ['coffeelint', 'csslint', 'lesslint'])
grunt.registerTask('test', ['shell:kill-atom', 'run-specs'])
grunt.registerTask('test', ['shell:kill-atom', 'run-core-specs', 'run-specs'])
grunt.registerTask('ci', ['lint', 'update-atom-shell', 'build', 'set-development-version', 'test'])
grunt.registerTask('deploy', ['partial-clean', 'update-atom-shell', 'build', 'codesign'])
grunt.registerTask('docs', ['markdown:guides', 'build-docs'])

View File

@ -7,11 +7,10 @@ async = require 'async'
module.exports = (grunt) ->
{isAtomPackage, spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'run-specs', 'Run the specs', ->
runPackageSpecs = (callback) ->
passed = true
done = @async()
appDir = grunt.config.get('atom.appDir')
rootDir = grunt.config.get('atom.shellAppDir')
appDir = grunt.config.get('atom.appDir')
atomPath = path.join(appDir, 'atom.sh')
apmPath = path.join(appDir, 'node_modules/.bin/apm')
@ -34,5 +33,21 @@ module.exports = (grunt) ->
continue unless isAtomPackage(packagePath)
queue.push(packagePath)
queue.concurrency = 2
queue.drain = -> done(passed)
queue.concurrency = 1
queue.drain = -> callback(passed)
runCoreSpecs = (callback) ->
contentsDir = grunt.config.get('atom.contentsDir')
appPath = path.join(contentsDir, 'MacOS', 'Atom')
resourcePath = process.cwd()
coreSpecsPath = path.resolve('spec')
options =
cmd: appPath
args: ['--test', "--resource-path=#{resourcePath}", "--spec-directory=#{coreSpecsPath}"]
spawn options, (error, results, code) ->
callback(code is 0)
grunt.registerTask 'run-specs', 'Run the specs', ->
passed = true
async.parallel([runCoreSpecs, runPackageSpecs], @async())