Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5915d7963 | ||
|
|
15587f3ce3 | ||
|
|
3ecddc2555 | ||
|
|
84daa0f5dc | ||
|
|
c6b3e947e9 |
@@ -3125,6 +3125,10 @@ getJasmineRequireObj().Clock = function() {
|
|||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
this.uninstall = function() {
|
this.uninstall = function() {
|
||||||
|
// Ensure auto ticking loop is aborted when clock is uninstalled
|
||||||
|
if (tickMode.mode === 'auto') {
|
||||||
|
tickMode = { mode: 'manual', counter: tickMode.counter + 1 };
|
||||||
|
}
|
||||||
delayedFunctionScheduler = null;
|
delayedFunctionScheduler = null;
|
||||||
mockDate.uninstall();
|
mockDate.uninstall();
|
||||||
replace(global, realTimingFunctions);
|
replace(global, realTimingFunctions);
|
||||||
@@ -11391,5 +11395,5 @@ getJasmineRequireObj().UserContext = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().version = function() {
|
getJasmineRequireObj().version = function() {
|
||||||
return '5.7.0';
|
return '5.7.1';
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jasmine-core",
|
"name": "jasmine-core",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "5.7.0",
|
"version": "5.7.1",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/jasmine/jasmine.git"
|
"url": "https://github.com/jasmine/jasmine.git"
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
to automatically tick the clock asynchronously
|
to automatically tick the clock asynchronously
|
||||||
* Merges #2042 from @atscott and @stephenfarrar
|
* Merges #2042 from @atscott and @stephenfarrar
|
||||||
* Fixes #1725
|
* Fixes #1725
|
||||||
* Fixes #1932
|
|
||||||
|
|
||||||
* Expose [spec path](https://jasmine.github.io/api/5.7/Spec.html#getPath) as an
|
* Expose [spec path](https://jasmine.github.io/api/5.7/Spec.html#getPath) as an
|
||||||
array of names in addition to the existing concatenated name
|
array of names in addition to the existing concatenated name
|
||||||
@@ -54,10 +53,9 @@ This version has been tested in the following environments.
|
|||||||
|
|
||||||
\* Evergreen browser. Each version of Jasmine is tested against the latest
|
\* Evergreen browser. Each version of Jasmine is tested against the latest
|
||||||
version available at release time.<br>
|
version available at release time.<br>
|
||||||
\** Environments that are past end of life are supported on a best-effort basis.
|
\** Supported on a best-effort basis. Support for these versions may be dropped
|
||||||
They may be dropped in a future minor release of Jasmine if continued support
|
if it becomes impractical, and bugs affecting only these versions may not be
|
||||||
becomes impractical.
|
treated as release blockers.
|
||||||
|
|
||||||
|
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|||||||
28
release_notes/5.7.1.md
Normal file
28
release_notes/5.7.1.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Jasmine Core 5.7.1 Release Notes
|
||||||
|
|
||||||
|
## Bug fixes
|
||||||
|
|
||||||
|
* Ensure that uninstalling the clock also stops auto tick
|
||||||
|
* Merges #2057 from @atscott
|
||||||
|
|
||||||
|
## Supported environments
|
||||||
|
|
||||||
|
This version has been tested in the following environments.
|
||||||
|
|
||||||
|
| Environment | Supported versions |
|
||||||
|
|-------------------|-------------------------|
|
||||||
|
| Node | 18**, 20, 22 |
|
||||||
|
| Safari | 15**, 16**, 17** |
|
||||||
|
| Chrome | 136* |
|
||||||
|
| Firefox | 102**, 115**, 128, 138* |
|
||||||
|
| Edge | 135* |
|
||||||
|
|
||||||
|
\* Evergreen browser. Each version of Jasmine is tested against the latest
|
||||||
|
version available at release time.<br>
|
||||||
|
\** Supported on a best-effort basis. Support for these versions may be dropped
|
||||||
|
if it becomes impractical, and bugs affecting only these versions may not be
|
||||||
|
treated as release blockers.
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||||
@@ -699,16 +699,19 @@ describe('Clock (acceptance)', function() {
|
|||||||
tick: function() {},
|
tick: function() {},
|
||||||
uninstall: function() {}
|
uninstall: function() {}
|
||||||
};
|
};
|
||||||
|
// window setTimeout to window to make firefox happy
|
||||||
|
const _setTimeout =
|
||||||
|
typeof window !== 'undefined' ? setTimeout.bind(window) : setTimeout;
|
||||||
|
// passing a fake global allows us to preserve the real timing functions for use in tests
|
||||||
|
const _global = { setTimeout: _setTimeout, setInterval: setInterval };
|
||||||
clock = new jasmineUnderTest.Clock(
|
clock = new jasmineUnderTest.Clock(
|
||||||
// We use the real window for global or firefox is displeased when we try to call a real setTimeout on an object "that doesn't implement window".
|
_global,
|
||||||
typeof window !== 'undefined' ? window : { setTimeout: setTimeout },
|
|
||||||
function() {
|
function() {
|
||||||
return delayedFunctionScheduler;
|
return delayedFunctionScheduler;
|
||||||
},
|
},
|
||||||
mockDate
|
mockDate
|
||||||
);
|
);
|
||||||
clock.install();
|
clock.install().autoTick();
|
||||||
clock.autoTick();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -776,6 +779,26 @@ describe('Clock (acceptance)', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('aborts auto ticking when uninstalled, even if installed again synchonrously', async () => {
|
||||||
|
clock.uninstall();
|
||||||
|
clock.install();
|
||||||
|
|
||||||
|
let resolved = false;
|
||||||
|
const promise = new Promise(resolve => {
|
||||||
|
clock.setTimeout(resolve, 1);
|
||||||
|
}).then(() => {
|
||||||
|
resolved = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
// wait some real time and verify that the clock did not flush the timer above automatically
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 2));
|
||||||
|
expect(resolved).toBe(false);
|
||||||
|
|
||||||
|
// enabling auto tick again will flush the timer
|
||||||
|
clock.autoTick();
|
||||||
|
await expectAsync(promise).toBeResolved();
|
||||||
|
});
|
||||||
|
|
||||||
it('speeds up the execution of the timers in all browsers', async () => {
|
it('speeds up the execution of the timers in all browsers', async () => {
|
||||||
const startTimeMs = performance.now() / 1000;
|
const startTimeMs = performance.now() / 1000;
|
||||||
await new Promise(resolve => clock.setTimeout(resolve, 5000));
|
await new Promise(resolve => clock.setTimeout(resolve, 5000));
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ getJasmineRequireObj().Clock = function() {
|
|||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
this.uninstall = function() {
|
this.uninstall = function() {
|
||||||
|
// Ensure auto ticking loop is aborted when clock is uninstalled
|
||||||
|
if (tickMode.mode === 'auto') {
|
||||||
|
tickMode = { mode: 'manual', counter: tickMode.counter + 1 };
|
||||||
|
}
|
||||||
delayedFunctionScheduler = null;
|
delayedFunctionScheduler = null;
|
||||||
mockDate.uninstall();
|
mockDate.uninstall();
|
||||||
replace(global, realTimingFunctions);
|
replace(global, realTimingFunctions);
|
||||||
|
|||||||
Reference in New Issue
Block a user