1
0
Fork 0

fix terser reporter

This commit is contained in:
Enoch Riese 2023-03-19 19:35:11 -05:00
parent 23fa1fdb9d
commit 1200bea79c

View file

@ -2,7 +2,7 @@ const Mocha = require('mocha')
const { EVENT_TEST_FAIL, EVENT_RUN_END } = Mocha.Runner.constants const { EVENT_TEST_FAIL, EVENT_RUN_END } = Mocha.Runner.constants
const path = require('path') const path = require('path')
const projectRoot = path.normalize(path.join(__dirname, '..')) const projectRoot = path.normalize(path.join(__dirname, '../..'))
const outputLog = path.join(projectRoot, '.test-failures.log') const outputLog = path.join(projectRoot, '.test-failures.log')
const red = function (string) { const red = function (string) {
@ -26,11 +26,12 @@ class TerseReporter {
runner.on(EVENT_TEST_FAIL, (test, err) => { runner.on(EVENT_TEST_FAIL, (test, err) => {
// output to the console // output to the console
console.log(`FAIL: ${test.fullTitle()}`) console.log(`FAIL: ${test.fullTitle()}`)
console.log(err) console.error(err)
// save for adding to an output file // save for adding to an output file
failuresPerFile[this.currentTest.file] = failuresPerFile[this.currentTest.file] || [] test.err = err
failuresPerFile[this.currentTest.file].push(this.currentTest) failuresPerFile[test.file] = failuresPerFile[test.file] || []
failuresPerFile[test.file].push(test)
}) })
runner.on(EVENT_RUN_END, () => { runner.on(EVENT_RUN_END, () => {