1
0
Fork 0
freesewing/scripts/testall.js

25 lines
762 B
JavaScript
Raw Permalink 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-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')
// 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-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-11-15 10:29:13 -06:00
// Propagate the exit code.
process.exit(code)
})