Removed support for custom promise libraries

All supported platforms now provide promises, so there's no longer a need
for Jasmine to be able to create them via a user-provided library. Jasmine
can still consume non-native promises but will always use the built-in
Promise object to create promises.

[#179078103]
This commit is contained in:
Steve Gravrock
2021-08-30 19:07:26 -07:00
parent 37b9f8e420
commit d61800c5c8
8 changed files with 22 additions and 237 deletions

View File

@@ -27,24 +27,6 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
}
}
var getPromise =
typeof options.getPromise === 'function'
? options.getPromise
: function() {};
var requirePromise = function(name) {
var Promise = getPromise();
if (!Promise) {
throw new Error(
name +
' requires global Promise, or `Promise` configured with `jasmine.getEnv().configure()`'
);
}
return Promise;
};
/**
* Tell the spy to return a promise resolving to the specified value when invoked.
* @name SpyStrategy#resolveTo
@@ -53,7 +35,6 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
* @param {*} value The value to return.
*/
this.resolveTo = function(value) {
var Promise = requirePromise('resolveTo');
self.plan = function() {
return Promise.resolve(value);
};
@@ -68,8 +49,6 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
* @param {*} value The value to return.
*/
this.rejectWith = function(value) {
var Promise = requirePromise('rejectWith');
self.plan = function() {
return Promise.reject(value);
};