1
0
Fork 0
freesewing/scripts/testall.js

41 lines
984 B
JavaScript
Raw Normal View History

const fs = require('fs')
2022-11-15 10:29:13 -06:00
const path = require('path')
const spawn = require('child_process').spawn
2022-11-15 10:29:13 -06:00
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)) {
2022-11-15 10:29:13 -06:00
fs.unlinkSync(outputLog)
}
// Run all tests, specifying the collector script.
2022-11-15 10:29:13 -06:00
spawn(
'lerna',
[
'run',
'--no-bail',
2022-11-15 12:02:46 -06:00
'testci',
2022-11-15 10:29:13 -06:00
'--stream',
'--parallel',
2022-11-15 10:47:57 -06:00
'--loglevel',
'error',
2022-11-15 10:29:13 -06:00
'--',
'--file',
`${collectorScript}`,
2022-11-15 11:32:48 -06:00
'--no-warnings',
2022-11-15 12:10:38 -06:00
'--timeout=15000',
2022-11-15 10:29:13 -06:00
],
{ 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())
}
2022-11-15 10:29:13 -06:00
// Propagate the exit code.
process.exit(code)
})