From d0a9931ae6bfa63c73952a07b1cff05b2a8b38e8 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Sun, 12 Jun 2022 15:52:14 -0700 Subject: [PATCH] Separated reporter- and runable-specific queue runner configuration --- lib/jasmine-core/jasmine.js | 36 +++++++++++++++++++----------------- src/core/Env.js | 20 ++++---------------- src/core/Runner.js | 16 +++++++++++++++- 3 files changed, 38 insertions(+), 34 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index fded7360..1fbf7841 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1458,21 +1458,6 @@ getJasmineRequireObj().Env = function(j$) { }; function queueRunnerFactory(options) { - if (options.isLeaf) { - // A spec - options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy; - } else if (options.isReporter) { - // A reporter queue - options.SkipPolicy = j$.NeverSkipPolicy; - } else { - // A suite - if (config.stopOnSpecFailure) { - options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy; - } else { - options.SkipPolicy = j$.SkipAfterBeforeAllErrorPolicy; - } - } - options.clearStack = options.clearStack || clearStack; options.timeout = { setTimeout: realSetTimeout, @@ -1586,7 +1571,10 @@ getJasmineRequireObj().Env = function(j$) { */ 'specDone' ], - queueRunnerFactory, + function(options) { + options.SkipPolicy = j$.NeverSkipPolicy; + return queueRunnerFactory(options); + }, recordLateError ); @@ -8306,7 +8294,21 @@ getJasmineRequireObj().Runner = function(j$) { const processor = new j$.TreeProcessor({ tree: this.topSuite_, runnableIds: runablesToRun, - queueRunnerFactory: this.queueRunnerFactory_, + queueRunnerFactory: options => { + if (options.isLeaf) { + // A spec + options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy; + } else { + // A suite + if (config.stopOnSpecFailure) { + options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy; + } else { + options.SkipPolicy = j$.SkipAfterBeforeAllErrorPolicy; + } + } + + return this.queueRunnerFactory_(options); + }, failSpecWithNoExpectations: config.failSpecWithNoExpectations, nodeStart: (suite, next) => { this.currentlyExecutingSuites_.push(suite); diff --git a/src/core/Env.js b/src/core/Env.js index c5490b55..49076754 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -365,21 +365,6 @@ getJasmineRequireObj().Env = function(j$) { }; function queueRunnerFactory(options) { - if (options.isLeaf) { - // A spec - options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy; - } else if (options.isReporter) { - // A reporter queue - options.SkipPolicy = j$.NeverSkipPolicy; - } else { - // A suite - if (config.stopOnSpecFailure) { - options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy; - } else { - options.SkipPolicy = j$.SkipAfterBeforeAllErrorPolicy; - } - } - options.clearStack = options.clearStack || clearStack; options.timeout = { setTimeout: realSetTimeout, @@ -493,7 +478,10 @@ getJasmineRequireObj().Env = function(j$) { */ 'specDone' ], - queueRunnerFactory, + function(options) { + options.SkipPolicy = j$.NeverSkipPolicy; + return queueRunnerFactory(options); + }, recordLateError ); diff --git a/src/core/Runner.js b/src/core/Runner.js index e566d73e..10df5195 100644 --- a/src/core/Runner.js +++ b/src/core/Runner.js @@ -57,7 +57,21 @@ getJasmineRequireObj().Runner = function(j$) { const processor = new j$.TreeProcessor({ tree: this.topSuite_, runnableIds: runablesToRun, - queueRunnerFactory: this.queueRunnerFactory_, + queueRunnerFactory: options => { + if (options.isLeaf) { + // A spec + options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy; + } else { + // A suite + if (config.stopOnSpecFailure) { + options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy; + } else { + options.SkipPolicy = j$.SkipAfterBeforeAllErrorPolicy; + } + } + + return this.queueRunnerFactory_(options); + }, failSpecWithNoExpectations: config.failSpecWithNoExpectations, nodeStart: (suite, next) => { this.currentlyExecutingSuites_.push(suite);