2022-02-04 13:22:48 +01:00
|
|
|
const fs = require('fs')
|
2022-11-15 10:29:13 -06:00
|
|
|
const path = require('path')
|
2022-02-04 13:22:48 +01:00
|
|
|
const spawn = require('child_process').spawn
|
|
|
|
|
2022-11-16 12:00:49 -06:00
|
|
|
const projectRoot = path.normalize(path.join(__dirname, '..'))
|
2022-11-15 10:29:13 -06:00
|
|
|
const outputLog = path.join(projectRoot, '.test-failures.log')
|
2022-02-04 13:22:48 +01:00
|
|
|
|
|
|
|
// Start with a fresh output log on each run.
|
|
|
|
if (fs.existsSync(outputLog)) {
|
2022-11-15 10:29:13 -06:00
|
|
|
fs.unlinkSync(outputLog)
|
2022-02-04 13:22:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Run all tests, specifying the collector script.
|
2022-11-16 11:55:55 -06:00
|
|
|
spawn('lerna', ['run', '--no-bail', 'testci', '--loglevel', 'error', '--', '--no-warnings'], {
|
|
|
|
stdio: 'inherit',
|
|
|
|
}).on('exit', function (code) {
|
2022-11-15 10:29:13 -06:00
|
|
|
// If a failure occurred, the log file will have been created. Print it.
|
|
|
|
if (fs.existsSync(outputLog)) {
|
|
|
|
console.error(fs.readFileSync(outputLog, 'utf8').trim())
|
|
|
|
}
|
2022-02-04 13:22:48 +01:00
|
|
|
|
2022-11-15 10:29:13 -06:00
|
|
|
// Propagate the exit code.
|
|
|
|
process.exit(code)
|
|
|
|
})
|