diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/empty-array-pattern/exec.js b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/empty-array-pattern/exec.js index 3f6b5c2e87a1..11b986e55053 100644 --- a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/empty-array-pattern/exec.js +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/empty-array-pattern/exec.js @@ -14,13 +14,15 @@ expect(function () { var [] = { [Symbol.iterator]: function() {} }; }).toThrow("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -var [] = []; -var [] = [0, 1, 2]; -var [] = "foo"; -var [] = (function*() { throw new Error("Should not throw"); })(); -var [] = { [Symbol.iterator]: function() { return {}; } } -var [] = { [Symbol.iterator]: function() { return function() {}; } } -var [] = { [Symbol.iterator]: async function*() {} } +expect(function () { + var [] = []; + var [] = [0, 1, 2]; + var [] = "foo"; + var [] = (function*() { throw new Error("Should not throw"); })(); + var [] = { [Symbol.iterator]: function() { return {}; } } + var [] = { [Symbol.iterator]: function() { return function() {}; } } + var [] = { [Symbol.iterator]: async function*() {} } +}).not.toThrow(); var returnCalled = false; var [] = { diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/exec.js b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/exec.js new file mode 100644 index 000000000000..200fe886738f --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/exec.js @@ -0,0 +1,3 @@ +expect(() => { + var [] = { [Symbol.iterator]: () => [] }; +}).not.toThrow(); diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/input.js b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/input.js new file mode 100644 index 000000000000..fa976372b57a --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/input.js @@ -0,0 +1 @@ +var [] = { [Symbol.iterator]: () => [] }; diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/options.json b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/options.json new file mode 100644 index 000000000000..84e28c07f51e --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-destructuring"] +} diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/output.js b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/output.js new file mode 100644 index 000000000000..678e2655ef49 --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15154/output.js @@ -0,0 +1,4 @@ +var _Symbol$iterator = { + [Symbol.iterator]: () => [] + }, + _Symbol$iterator2 = babelHelpers.slicedToArray(_Symbol$iterator, 0); diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/exec.js b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/exec.js new file mode 100644 index 000000000000..d1a3ff74de70 --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/exec.js @@ -0,0 +1,3 @@ +expect(() => { + var [] = { [Symbol.iterator]: () => async function* () {} }; +}).not.toThrow(); diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/input.js b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/input.js new file mode 100644 index 000000000000..e7edfef99ff4 --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/input.js @@ -0,0 +1 @@ +var [] = { [Symbol.iterator]: () => async function* () {} }; diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/options.json b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/options.json new file mode 100644 index 000000000000..84e28c07f51e --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-destructuring"] +} diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/output.js b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/output.js new file mode 100644 index 000000000000..5bd8618795bb --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/15168/output.js @@ -0,0 +1,4 @@ +var _Symbol$iterator = { + [Symbol.iterator]: () => async function* () {} + }, + _Symbol$iterator2 = babelHelpers.slicedToArray(_Symbol$iterator, 0);