From 350dd0140574683d3fc3a8c412ff7cb15f5a181b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Zugmeyer?= Date: Fri, 30 Aug 2024 11:54:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20don't=20print=20log=20messages?= =?UTF-8?q?=20twice=20in=20unit=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `baseReporterDecorator` implements a bunch of methods that display messages in the console. Since we already have a reporter for that, messages are displayed twice. Without `baseReporterDecorator`, `specSkipped` and `specFailure` "hooks" don't exist anymore, so let's use `onSpecComplete` instead. --- test/unit/karmaSkippedFailedReporterPlugin.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/unit/karmaSkippedFailedReporterPlugin.js b/test/unit/karmaSkippedFailedReporterPlugin.js index 1626160603..3ee46237d2 100644 --- a/test/unit/karmaSkippedFailedReporterPlugin.js +++ b/test/unit/karmaSkippedFailedReporterPlugin.js @@ -1,9 +1,7 @@ -function KarmaSkippedFailedReporter(baseReporterDecorator, logger) { +function KarmaSkippedFailedReporter(logger) { var log = logger.create('karma-skipped-failed') - baseReporterDecorator(this) - - this.specSkipped = this.specFailure = (browser, result) => { + this.onSpecComplete = (browser, result) => { if (result.skipped && !result.success) { log.warn('Failing skipped test:') log.warn(browser.name) @@ -13,7 +11,7 @@ function KarmaSkippedFailedReporter(baseReporterDecorator, logger) { } } -KarmaSkippedFailedReporter.$inject = ['baseReporterDecorator', 'logger'] +KarmaSkippedFailedReporter.$inject = ['logger'] module.exports = { 'reporter:karma-skipped-failed': ['type', KarmaSkippedFailedReporter],