From 70fbdc98b5c3021e14b06fbed90db1747a7afadc Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Sat, 20 Sep 2025 06:08:56 -0700 Subject: [PATCH] Revert to pre-5.0 default of creating a new core instance in each call to Node boot() --- lib/jasmine-core.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/jasmine-core.js b/lib/jasmine-core.js index e20680c4..30b95b2e 100644 --- a/lib/jasmine-core.js +++ b/lib/jasmine-core.js @@ -6,7 +6,7 @@ const jasmineRequire = require('./jasmine-core/jasmine.js'); module.exports = jasmineRequire; -const boot = (function() { +const bootWithoutGlobals = (function() { let jasmine, jasmineInterface; return function bootWithoutGlobals(reinitialize) { @@ -22,14 +22,16 @@ const boot = (function() { /** * Boots a copy of Jasmine and returns an object as described in {@link jasmine}. - * If boot is called multiple times, the same object is returned every time - * unless true is passed. - * @param {boolean} [reinitialize=false] Whether to create a new copy of Jasmine if one already exists + * @param {boolean} [reinitialize=true] Whether to create a new copy of Jasmine if one already exists * @type {function} * @return {jasmine} */ module.exports.boot = function(reinitialize) { - const {jasmine, jasmineInterface} = boot(reinitialize); + if (reinitialize === undefined) { + reinitialize = true; + } + + const {jasmine, jasmineInterface} = bootWithoutGlobals(reinitialize); for (const k in jasmineInterface) { global[k] = jasmineInterface[k]; @@ -48,7 +50,7 @@ module.exports.boot = function(reinitialize) { * const {describe, beforeEach, it, expect, jasmine} = require('jasmine-core').noGlobals(); */ module.exports.noGlobals = function(reinitialize) { - const {jasmineInterface} = boot(reinitialize); + const {jasmineInterface} = bootWithoutGlobals(reinitialize); return jasmineInterface; };