Run main process tests in test.js

This commit is contained in:
Nathan Sobo 2016-07-29 12:10:05 -06:00
parent 3d71112d75
commit 976c8007b8

View File

@ -11,22 +11,37 @@ const CONFIG = require('./config')
const packagedAppPath = path.resolve(__dirname, '..', 'out', 'Atom-darwin-x64')
const executablePath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'MacOS', 'Atom')
const resourcePath = CONFIG.repositoryRootPath
const testPath = path.join(CONFIG.repositoryRootPath, 'spec')
const testArguments = [
'--resource-path', resourcePath,
'--test', testPath
]
function runCoreSpecs (callback) {
console.log('Executing core specs...'.bold.green)
function runCoreMainProcessTests (callback) {
const testPath = path.join(CONFIG.repositoryRootPath, 'spec', 'main-process')
const testArguments = [
'--resource-path', resourcePath,
'--test', '--main-process', testPath
]
console.log('Executing core main process tests...'.bold.green)
const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit'})
cp.on('error', error => { callback(error) })
cp.on('close', exitCode => { callback(null, exitCode) })
}
async.parallelLimit([runCoreSpecs], 2, function (err, exitCodes) {
function runCoreRenderProcessTests (callback) {
const testPath = path.join(CONFIG.repositoryRootPath, 'spec')
const testArguments = [
'--resource-path', resourcePath,
'--test', testPath
]
console.log('Executing core render process tests...'.bold.green)
const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit'})
cp.on('error', error => { callback(error) })
cp.on('close', exitCode => { callback(null, exitCode) })
}
const testSuitesToRun = [runCoreMainProcessTests, runCoreRenderProcessTests]
async.parallelLimit(testSuitesToRun, 2, function (err, exitCodes) {
if (err) {
console.error(err)
process.exit(1)