Revert to pre-5.0 default of creating a new core instance in each call to Node boot()
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
const jasmineRequire = require('./jasmine-core/jasmine.js');
|
const jasmineRequire = require('./jasmine-core/jasmine.js');
|
||||||
module.exports = jasmineRequire;
|
module.exports = jasmineRequire;
|
||||||
|
|
||||||
const boot = (function() {
|
const bootWithoutGlobals = (function() {
|
||||||
let jasmine, jasmineInterface;
|
let jasmine, jasmineInterface;
|
||||||
|
|
||||||
return function bootWithoutGlobals(reinitialize) {
|
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}.
|
* 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
|
* @param {boolean} [reinitialize=true] Whether to create a new copy of Jasmine if one already exists
|
||||||
* unless true is passed.
|
|
||||||
* @param {boolean} [reinitialize=false] Whether to create a new copy of Jasmine if one already exists
|
|
||||||
* @type {function}
|
* @type {function}
|
||||||
* @return {jasmine}
|
* @return {jasmine}
|
||||||
*/
|
*/
|
||||||
module.exports.boot = function(reinitialize) {
|
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) {
|
for (const k in jasmineInterface) {
|
||||||
global[k] = jasmineInterface[k];
|
global[k] = jasmineInterface[k];
|
||||||
@@ -48,7 +50,7 @@ module.exports.boot = function(reinitialize) {
|
|||||||
* const {describe, beforeEach, it, expect, jasmine} = require('jasmine-core').noGlobals();
|
* const {describe, beforeEach, it, expect, jasmine} = require('jasmine-core').noGlobals();
|
||||||
*/
|
*/
|
||||||
module.exports.noGlobals = function(reinitialize) {
|
module.exports.noGlobals = function(reinitialize) {
|
||||||
const {jasmineInterface} = boot(reinitialize);
|
const {jasmineInterface} = bootWithoutGlobals(reinitialize);
|
||||||
return jasmineInterface;
|
return jasmineInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user