Add missing es7.promise.finally polyfill when using useBuiltIns: usage (#8500)

Usage of a `finally` instance method should trigger import of the `es7.promise.finally` polyfill, but it doesn't. This PR adds the missing definition and a test.
This commit is contained in:
Jarda Snajdr 2018-08-21 20:53:11 +02:00 committed by Henry Zhu
parent b439013cd4
commit 8874c5c481
4 changed files with 25 additions and 0 deletions

View File

@ -46,6 +46,7 @@ export const definitions = {
every: ["es6.array.is-array"], every: ["es6.array.is-array"],
fill: ["es6.array.fill"], fill: ["es6.array.fill"],
filter: ["es6.array.filter"], filter: ["es6.array.filter"],
finally: ["es7.promise.finally"],
find: ["es6.array.find"], find: ["es6.array.find"],
findIndex: ["es6.array.find-index"], findIndex: ["es6.array.find-index"],
fixed: ["es6.string.fixed"], fixed: ["es6.string.fixed"],

View File

@ -0,0 +1,4 @@
var p = Promise.resolve(0);
p.finally(() => {
alert("OK");
});

View File

@ -0,0 +1,14 @@
{
"presets": [
[
"../../../../lib",
{
"targets": {
"browsers": ["ie > 10"]
},
"useBuiltIns": "usage",
"modules": false
}
]
]
}

View File

@ -0,0 +1,6 @@
import "core-js/modules/es7.promise.finally";
import "core-js/modules/es6.promise";
var p = Promise.resolve(0);
p.finally(function () {
alert("OK");
});