preset-env: fix opera from esmodules target and Browserslist not used (#8555)

This commit is contained in:
ylemkimon 2018-11-09 01:29:49 +09:00 committed by Brian Ng
parent 343f776ca5
commit 7b54ab620b
2 changed files with 9 additions and 3 deletions

View File

@ -30,15 +30,16 @@ const validateTargetNames = (validTargets, targets) => {
}; };
const browserNameMap = { const browserNameMap = {
and_chr: "chrome",
android: "android", android: "android",
chrome: "chrome", chrome: "chrome",
and_chr: "chrome",
edge: "edge", edge: "edge",
firefox: "firefox", firefox: "firefox",
ie: "ie", ie: "ie",
ios_saf: "ios", ios_saf: "ios",
safari: "safari",
node: "node", node: "node",
opera: "opera",
safari: "safari",
}; };
export const isBrowsersQueryValid = ( export const isBrowsersQueryValid = (

View File

@ -99,11 +99,12 @@ describe("getTargets", () => {
it("works with current node version and string type browsers", () => { it("works with current node version and string type browsers", () => {
expect( expect(
getTargets({ getTargets({
browsers: "current node, chrome 55", browsers: "current node, chrome 55, opera 42",
}), }),
).toEqual({ ).toEqual({
node: process.versions.node, node: process.versions.node,
chrome: "55.0.0", chrome: "55.0.0",
opera: "42.0.0",
}); });
}); });
@ -178,6 +179,7 @@ describe("getTargets", () => {
chrome: "61.0.0", chrome: "61.0.0",
safari: "10.1.0", safari: "10.1.0",
firefox: "60.0.0", firefox: "60.0.0",
opera: "48.0.0",
ios: "10.3.0", ios: "10.3.0",
edge: "16.0.0", edge: "16.0.0",
}); });
@ -193,6 +195,7 @@ describe("getTargets", () => {
chrome: "61.0.0", chrome: "61.0.0",
safari: "10.1.0", safari: "10.1.0",
firefox: "60.0.0", firefox: "60.0.0",
opera: "48.0.0",
ios: "10.3.0", ios: "10.3.0",
edge: "16.0.0", edge: "16.0.0",
}); });
@ -208,6 +211,7 @@ describe("getTargets", () => {
chrome: "61.0.0", chrome: "61.0.0",
safari: "10.1.0", safari: "10.1.0",
firefox: "60.0.0", firefox: "60.0.0",
opera: "48.0.0",
ios: "10.3.0", ios: "10.3.0",
ie: "11.0.0", ie: "11.0.0",
edge: "16.0.0", edge: "16.0.0",
@ -228,6 +232,7 @@ describe("getTargets", () => {
ie: "11.0.0", ie: "11.0.0",
edge: "16.0.0", edge: "16.0.0",
firefox: "60.0.0", firefox: "60.0.0",
opera: "48.0.0",
}); });
}); });
}); });