Codebase list node-es6-promise / 5e762c1
Update upstream source from tag 'upstream/4.2.5' Update to upstream version '4.2.5' with Debian dir 65bc012f9be4232835f0868f4c8545d4886b3029 Julien Puydt 5 years ago
3 changed file(s) with 27 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
409409 let promise = this;
410410 let constructor = promise.constructor;
411411
412 return promise.then(value => constructor.resolve(callback()).then(() => value),
413 reason => constructor.resolve(callback()).then(() => { throw reason; }));
412 if ( isFunction(callback) ) {
413 return promise.then(value => constructor.resolve(callback()).then(() => value),
414 reason => constructor.resolve(callback()).then(() => { throw reason; }));
415 }
416
417 return promise.then(callback, callback);
414418 }
415419 }
416420
00 {
11 "name": "es6-promise",
22 "namespace": "es6-promise",
3 "version": "4.2.4",
3 "version": "4.2.5",
44 "description": "A lightweight library that provides tools for organizing asynchronous code",
55 "main": "dist/es6-promise.js",
66 "typings": "es6-promise.d.ts",
12571257 done();
12581258 });
12591259 });
1260
1261 it("preserves the original fulfillment value even if a non-callable callback is given", function(done) {
1262 var fulfillmentValue = 1;
1263 var promise = Promise.resolve(fulfillmentValue);
1264
1265 promise['finally']().then(function(value) {
1266 assert.equal(fulfillmentValue, value);
1267 done();
1268 });
1269 });
1270
1271 it("preserves the original rejection reason even if a non-callable callback is given", function(done) {
1272 var rejectionReason = new Error();
1273 var promise = Promise.reject(rejectionReason);
1274
1275 promise['finally']().then(undefined, function(reason) {
1276 assert.equal(rejectionReason, reason);
1277 done();
1278 });
1279 });
12601280 });
12611281
12621282 describe("exception cases do propogate the failure", function(){