mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-22 00:19:24 +03:00
Add test task that runs packages specs from queue
This commit is contained in:
parent
1ed01c5155
commit
483f63ab05
@ -181,7 +181,7 @@ module.exports = (grunt) ->
|
||||
|
||||
grunt.registerTask('compile', ['coffee', 'prebuild-less', 'cson'])
|
||||
grunt.registerTask('lint', ['coffeelint', 'csslint', 'lesslint'])
|
||||
grunt.registerTask('test', ['shell:kill-atom', 'shell:test'])
|
||||
grunt.registerTask('test', ['shell:kill-atom', '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'])
|
||||
|
33
tasks/test-task.coffee
Normal file
33
tasks/test-task.coffee
Normal file
@ -0,0 +1,33 @@
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
|
||||
async = require 'async'
|
||||
|
||||
module.exports = (grunt) ->
|
||||
{spawn} = require('./task-helpers')(grunt)
|
||||
|
||||
grunt.registerTask 'run-specs', 'Run the specs', ->
|
||||
passed = true
|
||||
done = @async()
|
||||
|
||||
queue = async.queue (packagePath, callback) ->
|
||||
options =
|
||||
cmd: path.resolve('node_modules/.bin/apm')
|
||||
args: ['test', '-p', path.resolve('atom.sh')]
|
||||
opts:
|
||||
cwd: packagePath
|
||||
spawn options, (error, results, code) ->
|
||||
passed = passed and code is 0
|
||||
callback()
|
||||
|
||||
modulesDirectory = path.resolve('node_modules')
|
||||
for packageDirectory in fs.readdirSync(modulesDirectory)
|
||||
packagePath = path.join(modulesDirectory, packageDirectory)
|
||||
continue unless grunt.file.isDir(path.join(packagePath, 'spec'))
|
||||
try
|
||||
{engines} = grunt.file.readJSON(path.join(packagePath, 'package.json')) ? {}
|
||||
queue.push(packagePath) if engines.atom?
|
||||
break
|
||||
|
||||
queue.concurrency = 1
|
||||
queue.drain = -> done(passed)
|
Loading…
Reference in New Issue
Block a user