From 1dc84e673a45e95d229b5a4ced07326198cb7d07 Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Sun, 20 Mar 2022 12:30:28 -0400 Subject: [PATCH] WIP: adds two failing tests --- .../usage-pure/preset-env-supported/options.json | 8 ++++---- .../babel-plugin-polyfill-regenerator/test/options.js | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/babel-plugin-polyfill-regenerator/test/fixtures/usage-pure/preset-env-supported/options.json b/packages/babel-plugin-polyfill-regenerator/test/fixtures/usage-pure/preset-env-supported/options.json index 1989e21b..2bf1816c 100644 --- a/packages/babel-plugin-polyfill-regenerator/test/fixtures/usage-pure/preset-env-supported/options.json +++ b/packages/babel-plugin-polyfill-regenerator/test/fixtures/usage-pure/preset-env-supported/options.json @@ -1,4 +1,7 @@ { + "targets": { + "chrome": 70 + }, "plugins": [ [ "@@/polyfill-regenerator", @@ -11,10 +14,7 @@ [ "@babel/preset-env", { - "modules": false, - "targets": { - "chrome": 70 - } + "modules": false } ] ] diff --git a/packages/babel-plugin-polyfill-regenerator/test/options.js b/packages/babel-plugin-polyfill-regenerator/test/options.js index 7a631539..6d54dbe7 100644 --- a/packages/babel-plugin-polyfill-regenerator/test/options.js +++ b/packages/babel-plugin-polyfill-regenerator/test/options.js @@ -4,6 +4,7 @@ import polyfillRegenerator from "../lib"; function transform(code, opts) { return babel.transformSync(code, { configFile: false, + targets: { chrome: 50 }, plugins: [[polyfillRegenerator, opts]], }); } @@ -18,3 +19,13 @@ describe("targets", () => { ).toThrow(/targets/); }); }); + +describe("top-level targets", () => { + it("is supported", () => { + expect(() => + transform("code", { + method: "usage-pure", + }), + ).not.toThrow(/targets/); + }); +})