Revert to pre-5.0 default of creating a new core instance in each call to Node boot()

This commit is contained in:
Steve Gravrock
2025-09-20 06:08:56 -07:00
parent 4166ea791c
commit 70fbdc98b5

View File

@@ -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;
};