mirror of
https://github.com/atom/atom.git
synced 2026-01-26 15:28:27 -05:00
Merge pull request #19145 from atom/add-traces-to-test
Add debug traces to failing test steps
This commit is contained in:
21
script/test
21
script/test
@@ -87,7 +87,7 @@ function runCoreMainProcessTests (callback) {
|
||||
console.log('Executing core main process tests'.bold.green)
|
||||
const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit', env: testEnv})
|
||||
cp.on('error', error => { callback(error) })
|
||||
cp.on('close', exitCode => { callback(null, exitCode) })
|
||||
cp.on('close', exitCode => { callback(null, {exitCode, step: 'core-main-process'}) })
|
||||
}
|
||||
|
||||
function runCoreRenderProcessTests (callback) {
|
||||
@@ -101,7 +101,7 @@ function runCoreRenderProcessTests (callback) {
|
||||
console.log('Executing core render process tests'.bold.green)
|
||||
const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit', env: testEnv})
|
||||
cp.on('error', error => { callback(error) })
|
||||
cp.on('close', exitCode => { callback(null, exitCode) })
|
||||
cp.on('close', exitCode => { callback(null, {exitCode, step: 'core-render-process'}) })
|
||||
}
|
||||
|
||||
// Build an array of functions, each running tests for a different bundled package
|
||||
@@ -118,7 +118,7 @@ for (let packageName in CONFIG.appMetadata.packageDependencies) {
|
||||
if (!testSubdir) {
|
||||
packageTestSuites.push(function (callback) {
|
||||
console.log(`Skipping tests for ${packageName} because no test folder was found`.bold.yellow)
|
||||
callback(null, 0)
|
||||
callback(null, {exitCode: 0, step: `package-${packageName}`})
|
||||
})
|
||||
continue
|
||||
}
|
||||
@@ -162,7 +162,7 @@ for (let packageName in CONFIG.appMetadata.packageDependencies) {
|
||||
console.log(stderrOutput)
|
||||
}
|
||||
finalize()
|
||||
callback(null, exitCode)
|
||||
callback(null, {exitCode, step: `package-${packageName}`})
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -175,7 +175,7 @@ function runBenchmarkTests (callback) {
|
||||
console.log('Executing benchmark tests'.bold.green)
|
||||
const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit', env: testEnv})
|
||||
cp.on('error', error => { callback(error) })
|
||||
cp.on('close', exitCode => { callback(null, exitCode) })
|
||||
cp.on('close', exitCode => { callback(null, {exitCode, step: 'core-benchmarks'}) })
|
||||
}
|
||||
|
||||
let testSuitesToRun = requestedTestSuites() || testSuitesForPlatform(process.platform)
|
||||
@@ -220,12 +220,17 @@ function testSuitesForPlatform (platform) {
|
||||
return suites
|
||||
}
|
||||
|
||||
async.series(testSuitesToRun, function (err, exitCodes) {
|
||||
async.series(testSuitesToRun, function (err, results) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
} else {
|
||||
const testsPassed = exitCodes.every(exitCode => exitCode === 0)
|
||||
process.exit(testsPassed ? 0 : 1)
|
||||
const failedSteps = results.filter(({exitCode}) => exitCode !== 0)
|
||||
|
||||
for (const {step} of failedSteps) {
|
||||
console.error(`Error! The '${step}' test step finished with a non-zero exit code`)
|
||||
}
|
||||
|
||||
process.exit(failedSteps.length === 0 ? 0 : 1)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user