Compare commits

..

2 Commits

Author SHA1 Message Date
Steve Gravrock b617d983de Bump version to 5.0.1 2023-06-09 16:24:00 -07:00
Steve Gravrock 8e0f0e8e8c Optionally restore the pre-5.0 behavior of boot() always creating a new instance
This is needed by jasmine-npm (and likely other tools like it) that may
need to create and use multiple envs in sequence.
2023-06-05 19:44:06 -07:00
4 changed files with 41 additions and 13 deletions
+12 -9
View File
@@ -6,11 +6,11 @@
const jasmineRequire = require('./jasmine-core/jasmine.js'); const jasmineRequire = require('./jasmine-core/jasmine.js');
module.exports = jasmineRequire; module.exports = jasmineRequire;
const bootOnce = (function() { const boot = (function() {
let jasmine, jasmineInterface; let jasmine, jasmineInterface;
return function bootWithoutGlobals() { return function bootWithoutGlobals(reinitialize) {
if (!jasmineInterface) { if (!jasmineInterface || reinitialize === true) {
jasmine = jasmineRequire.core(jasmineRequire); jasmine = jasmineRequire.core(jasmineRequire);
const env = jasmine.getEnv({ suppressLoadErrors: true }); const env = jasmine.getEnv({ suppressLoadErrors: true });
jasmineInterface = jasmineRequire.interface(jasmine, env); jasmineInterface = jasmineRequire.interface(jasmine, env);
@@ -22,12 +22,14 @@ const bootOnce = (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. * 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
* @type {function} * @type {function}
* @return {jasmine} * @return {jasmine}
*/ */
module.exports.boot = function() { module.exports.boot = function(reinitialize) {
const {jasmine, jasmineInterface} = bootOnce(); const {jasmine, jasmineInterface} = boot(reinitialize);
for (const k in jasmineInterface) { for (const k in jasmineInterface) {
global[k] = jasmineInterface[k]; global[k] = jasmineInterface[k];
@@ -39,13 +41,14 @@ module.exports.boot = function() {
/** /**
* Boots a copy of Jasmine and returns an object containing the properties * Boots a copy of Jasmine and returns an object containing the properties
* that would normally be added to the global object. If noGlobals is called * that would normally be added to the global object. If noGlobals is called
* multiple times, the same object is returned every time. * 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
* @example * @example
* const {describe, beforeEach, it, expect, jasmine} = require('jasmine-core').noGlobals(); * const {describe, beforeEach, it, expect, jasmine} = require('jasmine-core').noGlobals();
*/ */
module.exports.noGlobals = function() { module.exports.noGlobals = function(reinitialize) {
const {jasmineInterface} = bootOnce(); const {jasmineInterface} = boot(reinitialize);
return jasmineInterface; return jasmineInterface;
}; };
+1 -1
View File
@@ -10713,5 +10713,5 @@ getJasmineRequireObj().UserContext = function(j$) {
}; };
getJasmineRequireObj().version = function() { getJasmineRequireObj().version = function() {
return '5.0.0'; return '5.0.1';
}; };
+3 -3
View File
@@ -1,7 +1,7 @@
{ {
"name": "jasmine-core", "name": "jasmine-core",
"license": "MIT", "license": "MIT",
"version": "5.0.0", "version": "5.0.1",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/jasmine/jasmine.git" "url": "https://github.com/jasmine/jasmine.git"
@@ -43,8 +43,8 @@
"grunt-contrib-concat": "^2.0.0", "grunt-contrib-concat": "^2.0.0",
"grunt-css-url-embed": "^1.11.1", "grunt-css-url-embed": "^1.11.1",
"grunt-sass": "^3.0.2", "grunt-sass": "^3.0.2",
"jasmine": "5.0.0-beta.0", "jasmine": "^5.0.0",
"jasmine-browser-runner": "^1.0.0", "jasmine-browser-runner": "^2.0.0",
"jsdom": "^22.0.0", "jsdom": "^22.0.0",
"load-grunt-tasks": "^5.1.0", "load-grunt-tasks": "^5.1.0",
"prettier": "1.17.1", "prettier": "1.17.1",
+25
View File
@@ -0,0 +1,25 @@
# Jasmine Core 5.0.1 Release Notes
## Changes
* Optionally restore the pre-5.0 behavior of boot() always creating a new instance
This is needed by jasmine-npm (and likely other tools like it) that may
need to create and use multiple envs in sequence.
## Supported environments
jasmine-core 5.0.1 has been tested in the following environments.
| Environment | Supported versions |
|-------------------|--------------------|
| Node | 18, 20 |
| Safari | 15-16 |
| Chrome | 114 |
| Firefox | 102, 113 |
| Edge | 113 |
------
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_