From aa81f6c00c9fb53ed0bb4cf01cded396f5946b29 Mon Sep 17 00:00:00 2001 From: juergba Date: Wed, 12 Feb 2020 11:16:08 +0100 Subject: [PATCH] update suite.tests with last retried test --- lib/runner.js | 5 +++++ lib/test.js | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/runner.js b/lib/runner.js index ceb1a24a4f..d74efbb1ce 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -135,6 +135,11 @@ function Runner(suite, delay) { this.total = suite.total(); this.failures = 0; this.on(constants.EVENT_TEST_END, function(test) { + if (test._retriedTest && test.parent) { + var idx = + test.parent.tests && test.parent.tests.indexOf(test._retriedTest); + if (idx > -1) test.parent.tests[idx] = test; + } self.checkGlobals(test); }); this.on(constants.EVENT_HOOK_END, function(hook) { diff --git a/lib/test.js b/lib/test.js index f32008a85b..ce7b6d3718 100644 --- a/lib/test.js +++ b/lib/test.js @@ -43,6 +43,7 @@ Test.prototype.clone = function() { test.enableTimeouts(this.enableTimeouts()); test.retries(this.retries()); test.currentRetry(this.currentRetry()); + test._retriedTest = this._retriedTest || this; test.globals(this.globals()); test.parent = this.parent; test.file = this.file;