From 31b85a36dde8428fe6aefffa7cc94d6daff2d3af Mon Sep 17 00:00:00 2001 From: "Diogo Franco (Kovensky)" Date: Fri, 16 Dec 2016 11:25:42 +0900 Subject: [PATCH] Add fixture for known bug --- .../actual.js | 5 +++++ .../expected.js | 16 ++++++++++++++++ .../options.json | 3 +++ 3 files changed, 24 insertions(+) create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/actual.js create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/expected.js create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/options.json diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/actual.js b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/actual.js new file mode 100644 index 0000000000..f56af5c601 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/actual.js @@ -0,0 +1,5 @@ +// I don't know if this is a bug with arrow-functions spec: true +// or with function-name, but the functions are missing their names. +const x = () => x; +const y = x => x(); +const z = { z: () => y(x) }.z; diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/expected.js b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/expected.js new file mode 100644 index 0000000000..b842455dae --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/expected.js @@ -0,0 +1,16 @@ +var _this = this; + +// I don't know if this is a bug with arrow-functions spec: true +// or with function-name, but the functions are missing their names. +const x = function () { + babelHelpers.newArrowCheck(this, _this); + return x; +}.bind(this); +const y = function (x) { + babelHelpers.newArrowCheck(this, _this); + return x(); +}.bind(this); +const z = { z: function z() { + babelHelpers.newArrowCheck(this, _this); + return y(x); + }.bind(this) }.z; \ No newline at end of file diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/options.json b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/options.json new file mode 100644 index 0000000000..d66c99f262 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["external-helpers", "transform-es2015-function-name", [ "transform-es2015-arrow-functions", { "spec": true } ]] +}