Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed Jul 26, 2020
1 parent 02bdb6b commit fe806f4
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/runner.js
Expand Up @@ -419,20 +419,6 @@ Runner.prototype.fail = function(test, err, force) {
* @param {Error} err
*/
Runner.prototype.failHook = function(hook, err) {
hook.originalTitle = hook.originalTitle || hook.title;
if (hook.ctx && hook.ctx.currentTest) {
hook.title =
hook.originalTitle + ' for ' + dQuote(hook.ctx.currentTest.title);
} else {
var parentTitle;
if (hook.parent.title) {
parentTitle = hook.parent.title;
} else {
parentTitle = hook.parent.root ? '{root}' : '';
}
hook.title = hook.originalTitle + ' in ' + dQuote(parentTitle);
}

this.fail(hook, err);
};

Expand All @@ -456,6 +442,20 @@ Runner.prototype.hook = function(name, fn) {
}
self.currentRunnable = hook;

hook.originalTitle = hook.originalTitle || hook.title;
if (hook.ctx && hook.ctx.currentTest) {
hook.title =
hook.originalTitle + ' for ' + dQuote(hook.ctx.currentTest.title);
} else {
var parentTitle;
if (hook.parent.title) {
parentTitle = hook.parent.title;
} else {
parentTitle = hook.parent.root ? '{root}' : '';
}
hook.title = hook.originalTitle + ' in ' + dQuote(parentTitle);
}

if (name === HOOK_TYPE_BEFORE_ALL) {
hook.ctx.currentTest = hook.parent.tests[0];
} else if (name === HOOK_TYPE_AFTER_ALL) {
Expand Down

0 comments on commit fe806f4

Please sign in to comment.