1
0
Fork 0
This commit is contained in:
Enoch Riese 2022-11-16 11:55:55 -06:00
parent afcecc50ac
commit 7742d5cd21
2 changed files with 5 additions and 20 deletions

View file

@ -2,9 +2,7 @@ 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, 'tests', 'reporters', 'terser.js')
// Start with a fresh output log on each run.
if (fs.existsSync(outputLog)) {
@ -12,23 +10,9 @@ if (fs.existsSync(outputLog)) {
}
// Run all tests, specifying the collector script.
spawn(
'lerna',
[
'run',
'--no-bail',
'testci',
'--loglevel',
'error',
'--',
// '--reporter',
// 'min'
// '--reporter',
// `${collectorScript}`,
'--no-warnings',
],
{ stdio: 'inherit' }
).on('exit', function (code) {
spawn('lerna', ['run', '--no-bail', 'testci', '--loglevel', 'error', '--', '--no-warnings'], {
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())

View file

@ -28,6 +28,7 @@ class TerseReporter {
console.log(`FAIL: ${test.fullTitle()}`)
console.log(err)
// save for adding to an output file
failuresPerFile[this.currentTest.file] = failuresPerFile[this.currentTest.file] || []
failuresPerFile[this.currentTest.file].push(this.currentTest)
})
@ -50,7 +51,7 @@ class TerseReporter {
// Print each failure.
failures.forEach(function (failure, i) {
const stack = failure.err.stack.split('\n')
writeLine(`${file}: ${i + 1}\) ${failure.title}:`)
writeLine(`${file}: ${i + 1}) ${failure.title}:`)
writeLine(`${file}:`)
writeLine(`${file}: ${red(stack[0].trim())}`)
writeLine(`${file}: ${green('+ expected')} ${red('- actual')}`)