diff --git a/lib/core/base/rule.js b/lib/core/base/rule.js index 37b59904fe..2955cce29c 100644 --- a/lib/core/base/rule.js +++ b/lib/core/base/rule.js @@ -284,15 +284,21 @@ Rule.prototype.run = function run(context, options = {}, resolve, reject) { }); }); - // Defer the rule's execution to prevent "unresponsive script" warnings. - // See https://github.com/dequelabs/axe-core/pull/1172 for discussion and details. - q.defer(res => setTimeout(res, 0)); - - if (options.performanceTimer) { - this._logRulePerformance(); - } - - q.then(() => resolve(ruleResult)).catch(error => reject(error)); + q.then(() => { + if (options.performanceTimer) { + this._logRulePerformance(); + } + // Defer the rule's execution to prevent "unresponsive script" warnings. + // See https://github.com/dequelabs/axe-core/pull/1172 for discussion and details. + setTimeout(() => { + resolve(ruleResult); + }, 0); + }).catch(error => { + if (options.performanceTimer) { + this._logRulePerformance(); + } + reject(error); + }); }; /**