Compare commits

...

7 Commits

Author SHA1 Message Date
Steve Gravrock
0ae234dc6e Bump version to 4.0.1 2022-02-21 16:58:32 -08:00
Steve Gravrock
38d102f1d1 Merge branch '3.99.1' into 4.0.1 2022-02-21 16:45:34 -08:00
Steve Gravrock
906f37fe52 Bump version to 3.99.1 2022-02-21 16:30:15 -08:00
Steve Gravrock
4a2b10998a Remove Safari 8 and 9 from CI matrix
These browsers are still nominally supported by Jasmine 3.x, but they no
longer work on Saucelabs.
2022-02-19 14:23:02 -08:00
Steve Gravrock
d8b2efe4d6 Downgrade jasmine-browser-runner for compatibility with IE 2022-02-19 14:21:35 -08:00
Steve Gravrock
9d9e8f0c17 Lint fixes 2022-02-19 12:33:19 -08:00
Steve Gravrock
4059ab7ba6 Don't report a deprecation when a promise is resolved to something
beforeEach(() => somePromiseReturningFn()) is likely a common idiom
and we don't want to treat it as an error.

* Fixes #1958
2022-02-19 12:28:47 -08:00
7 changed files with 149 additions and 5 deletions

View File

@@ -36,7 +36,7 @@ When ready to release - specs are all green and the stories are done:
### Commit and push core changes ### Commit and push core changes
1. Run the browser tests using `scripts/run-all-browsers`. 1. Run the browser tests using `scripts/run-all-browsers`.
1. Commit release notes and version changes (jasmine.js, version.rb, package.json) 1. Commit release notes and version changes (jasmine.js, package.json)
1. Push 1. Push
1. Wait for Circle CI to go green 1. Wait for Circle CI to go green

View File

@@ -8031,7 +8031,10 @@ getJasmineRequireObj().QueueRunner = function(j$) {
maybeThenable = queueableFn.fn.call(self.userContext); maybeThenable = queueableFn.fn.call(self.userContext);
if (maybeThenable && j$.isFunction_(maybeThenable.then)) { if (maybeThenable && j$.isFunction_(maybeThenable.then)) {
maybeThenable.then(next, onPromiseRejection); maybeThenable.then(
wrapInPromiseResolutionHandler(next),
onPromiseRejection
);
completedSynchronously = false; completedSynchronously = false;
return { completedSynchronously: false }; return { completedSynchronously: false };
} }
@@ -8130,6 +8133,16 @@ getJasmineRequireObj().QueueRunner = function(j$) {
} }
}; };
function wrapInPromiseResolutionHandler(fn) {
return function(maybeArg) {
if (j$.isError_(maybeArg)) {
fn(maybeArg);
} else {
fn();
}
};
}
return QueueRunner; return QueueRunner;
}; };
@@ -10186,5 +10199,5 @@ getJasmineRequireObj().UserContext = function(j$) {
}; };
getJasmineRequireObj().version = function() { getJasmineRequireObj().version = function() {
return '4.0.0'; return '4.0.1';
}; };

View File

@@ -1,7 +1,7 @@
{ {
"name": "jasmine-core", "name": "jasmine-core",
"license": "MIT", "license": "MIT",
"version": "4.0.0", "version": "4.0.1",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/jasmine/jasmine.git" "url": "https://github.com/jasmine/jasmine.git"

22
release_notes/3.99.1.md Normal file
View File

@@ -0,0 +1,22 @@
# Jasmine Core 3.99.1 Release Notes
This release fixes a bug in 3.99.0, which incorrectly reported a deprecation
warning when a promise returned from a function passed to `it`, `beforeEach`,
etc was resolved to a value.
## Supported environments
jasmine-core 3.99.1 has been tested in the following environments.
| Environment | Supported versions |
|-------------------|--------------------|
| Node | 10, 12, 14, 16 |
| Safari | 10-14 |
| Chrome | 98 |
| Firefox | 97, 78, 68 |
| Edge | 98 |
| Internet Explorer | 10, 11 |
------
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_

21
release_notes/4.0.1.md Normal file
View File

@@ -0,0 +1,21 @@
# Jasmine Core 4.0.1 Release Notes
This release fixes a bug in 4.0.0, which incorrectly reported a failure
when a promise returned from a function passed to `it`, `beforeEach`,
etc was resolved to a value.
## Supported environments
jasmine-core 4.0.1 has been tested in the following environments.
| Environment | Supported versions |
|-------------------|--------------------|
| Node | 12.17+, 14, 16 |
| Safari | 14-15 |
| Chrome | 98 |
| Firefox | 91, 97 |
| Edge | 98 |
------
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_

View File

@@ -156,6 +156,81 @@ describe('QueueRunner', function() {
expect(failFn).toHaveBeenCalledWith(err); expect(failFn).toHaveBeenCalledWith(err);
expect(queueableFn2.fn).toHaveBeenCalled(); expect(queueableFn2.fn).toHaveBeenCalled();
}); });
describe('as a result of a promise', function() {
describe('and the argument is an Error', function() {
// Since promise support was added, Jasmine has failed specs that
// return a promise that resolves to an error. That's probably not
// the desired behavior but it's also not something we should change
// except on a major release and with a deprecation warning in
// advance.
it('explicitly fails and moves to the next function', function(done) {
var err = new Error('foo'),
queueableFn1 = {
fn: function() {
return Promise.resolve(err);
}
},
queueableFn2 = { fn: jasmine.createSpy('fn2') },
failFn = jasmine.createSpy('fail'),
queueRunner = new jasmineUnderTest.QueueRunner({
queueableFns: [queueableFn1, queueableFn2],
fail: failFn,
onComplete: function() {
expect(failFn).toHaveBeenCalledWith(err);
expect(queueableFn2.fn).toHaveBeenCalled();
done();
}
});
queueRunner.execute();
});
it('does not log a deprecation', function(done) {
var err = new Error('foo'),
queueableFn1 = {
fn: function() {
return Promise.resolve(err);
}
},
deprecated = jasmine.createSpy('deprecated'),
queueRunner = new jasmineUnderTest.QueueRunner({
queueableFns: [queueableFn1],
deprecated: deprecated,
onComplete: function() {
expect(deprecated).not.toHaveBeenCalled();
done();
}
});
queueRunner.execute();
});
});
describe('and the argument is not an Error', function() {
it('does not log a deprecation or report a failure', function(done) {
var queueableFn1 = {
fn: function() {
return Promise.resolve('not an error');
}
},
failFn = jasmine.createSpy('fail'),
deprecated = jasmine.createSpy('deprecated'),
queueRunner = new jasmineUnderTest.QueueRunner({
queueableFns: [queueableFn1],
deprecated: deprecated,
fail: failFn,
onComplete: function() {
expect(deprecated).not.toHaveBeenCalled();
expect(failFn).not.toHaveBeenCalled();
done();
}
});
queueRunner.execute();
});
});
});
}); });
it('does not cause an explicit fail if execution is being stopped', function() { it('does not cause an explicit fail if execution is being stopped', function() {

View File

@@ -177,7 +177,10 @@ getJasmineRequireObj().QueueRunner = function(j$) {
maybeThenable = queueableFn.fn.call(self.userContext); maybeThenable = queueableFn.fn.call(self.userContext);
if (maybeThenable && j$.isFunction_(maybeThenable.then)) { if (maybeThenable && j$.isFunction_(maybeThenable.then)) {
maybeThenable.then(next, onPromiseRejection); maybeThenable.then(
wrapInPromiseResolutionHandler(next),
onPromiseRejection
);
completedSynchronously = false; completedSynchronously = false;
return { completedSynchronously: false }; return { completedSynchronously: false };
} }
@@ -276,5 +279,15 @@ getJasmineRequireObj().QueueRunner = function(j$) {
} }
}; };
function wrapInPromiseResolutionHandler(fn) {
return function(maybeArg) {
if (j$.isError_(maybeArg)) {
fn(maybeArg);
} else {
fn();
}
};
}
return QueueRunner; return QueueRunner;
}; };