From 4ba42f3746557d4db11917bf4fd542bdad891180 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Tue, 22 Aug 2023 19:34:22 -0700 Subject: [PATCH] Fixed global variable leak when using ParallelReportDispatcher --- lib/jasmine-core/jasmine.js | 6 +++++- src/core/ParallelReportDispatcher.js | 4 +++- src/core/ReportDispatcher.js | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 67e5424f..0e9e1537 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -7161,6 +7161,8 @@ getJasmineRequireObj().NeverSkipPolicy = function(j$) { }; getJasmineRequireObj().ParallelReportDispatcher = function(j$) { + 'use strict'; + /** * @class ParallelReportDispatcher * @implements Reporter @@ -7179,7 +7181,7 @@ getJasmineRequireObj().ParallelReportDispatcher = function(j$) { const ReportDispatcher = deps.ReportDispatcher || j$.ReportDispatcher; const QueueRunner = deps.QueueRunner || j$.QueueRunner; const globalErrors = deps.globalErrors || new j$.GlobalErrors(); - const dispatcher = ReportDispatcher( + const dispatcher = new ReportDispatcher( j$.reporterEvents, function(queueRunnerOptions) { queueRunnerOptions = { @@ -7905,6 +7907,8 @@ getJasmineRequireObj().QueueRunner = function(j$) { }; getJasmineRequireObj().ReportDispatcher = function(j$) { + 'use strict'; + function ReportDispatcher(methods, queueRunnerFactory, onLateError) { const dispatchedMethods = methods || []; diff --git a/src/core/ParallelReportDispatcher.js b/src/core/ParallelReportDispatcher.js index 84d43461..db673065 100644 --- a/src/core/ParallelReportDispatcher.js +++ b/src/core/ParallelReportDispatcher.js @@ -1,4 +1,6 @@ getJasmineRequireObj().ParallelReportDispatcher = function(j$) { + 'use strict'; + /** * @class ParallelReportDispatcher * @implements Reporter @@ -17,7 +19,7 @@ getJasmineRequireObj().ParallelReportDispatcher = function(j$) { const ReportDispatcher = deps.ReportDispatcher || j$.ReportDispatcher; const QueueRunner = deps.QueueRunner || j$.QueueRunner; const globalErrors = deps.globalErrors || new j$.GlobalErrors(); - const dispatcher = ReportDispatcher( + const dispatcher = new ReportDispatcher( j$.reporterEvents, function(queueRunnerOptions) { queueRunnerOptions = { diff --git a/src/core/ReportDispatcher.js b/src/core/ReportDispatcher.js index 55759d03..94650c83 100644 --- a/src/core/ReportDispatcher.js +++ b/src/core/ReportDispatcher.js @@ -1,4 +1,6 @@ getJasmineRequireObj().ReportDispatcher = function(j$) { + 'use strict'; + function ReportDispatcher(methods, queueRunnerFactory, onLateError) { const dispatchedMethods = methods || [];