Add test retry support to reporter.

This commit is contained in:
Richard Moore 2020-09-04 03:15:07 -04:00
parent 4ca98825d4
commit 35b64b9a65
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

@ -1,5 +1,4 @@
/* istanbul ignore file */
'use strict';
// Maximum time in seconds to suppress output
@ -108,7 +107,6 @@ export function Reporter(runner: Runner) {
}
log(` Total Tests: ${ suite._countPass }/${ suite._countTotal } passed ${ getDelta(suite._t0) } ${ extra} \n`);
//log();
if (suites.length > 0) {
let currentSuite = suites[suites.length - 1];
@ -118,14 +116,22 @@ export function Reporter(runner: Runner) {
currentSuite._countTotal += suite._countTotal;
} else {
clearTimeout(timer);
log(`# status:${ (suite._countPass === suite._countTotal) ? 0: 1 }`);
const status = (suite._countPass === suite._countTotal) ? 0: 1;
log(`# status:${ status }`);
// Force quit after 5s
setTimeout(() => {
process.exit(status);
}, 5000);
}
});
runner.on('test', function(test) {
forceOutput();
const currentSuite = suites[suites.length - 1];
currentSuite._countTotal++;
if (test._currentRetry === 0) {
const currentSuite = suites[suites.length - 1];
currentSuite._countTotal++;
}
});
runner.on('fail', function(test, error) {