1
0
Fork 0
freesewing/scripts/testall.js
2022-11-15 16:17:04 -06:00

41 lines
1,003 B
JavaScript

const fs = require('fs')
const path = require('path')
const spawn = require('child_process').spawn
const projectRoot = path.normalize(path.join(__dirname, '..'))
const outputLog = path.join(projectRoot, '.test-failures.log')
const collectorScript = path.join(projectRoot, 'scripts', 'test-failure-collector.js')
// Start with a fresh output log on each run.
if (fs.existsSync(outputLog)) {
fs.unlinkSync(outputLog)
}
// Run all tests, specifying the collector script.
spawn(
'lerna',
[
'run',
'--no-bail',
'testci',
// '--stream',
// '--parallel',
'--loglevel',
'error',
'--',
// '--file',
// `${collectorScript}`,
'--no-warnings',
'--timeout',
'15000',
],
{ stdio: 'inherit' }
).on('exit', function (code) {
// If a failure occurred, the log file will have been created. Print it.
if (fs.existsSync(outputLog)) {
console.error(fs.readFileSync(outputLog, 'utf8').trim())
}
// Propagate the exit code.
process.exit(code)
})