diff --git a/packages/babel-plugin-transform-block-scoped-functions/README.md b/packages/babel-plugin-transform-block-scoped-functions/README.md index 835d7424bb..95985cf600 100644 --- a/packages/babel-plugin-transform-block-scoped-functions/README.md +++ b/packages/babel-plugin-transform-block-scoped-functions/README.md @@ -20,11 +20,10 @@ name("Steve"); ```javascript { - var _name = function _name(n) { + let name = function (n) { return n; }; } - name("Steve"); ``` diff --git a/packages/babel-plugin-transform-block-scoped-functions/test/fixtures/block-scoped-functions/basic/input.js b/packages/babel-plugin-transform-block-scoped-functions/test/fixtures/block-scoped-functions/basic/input.js new file mode 100644 index 0000000000..fe3cbae18f --- /dev/null +++ b/packages/babel-plugin-transform-block-scoped-functions/test/fixtures/block-scoped-functions/basic/input.js @@ -0,0 +1,7 @@ +{ + function name (n) { + return n; + } +} + +name("Steve"); diff --git a/packages/babel-plugin-transform-block-scoped-functions/test/fixtures/block-scoped-functions/basic/options.json b/packages/babel-plugin-transform-block-scoped-functions/test/fixtures/block-scoped-functions/basic/options.json new file mode 100644 index 0000000000..de68899ab3 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoped-functions/test/fixtures/block-scoped-functions/basic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-block-scoped-functions"] +} diff --git a/packages/babel-plugin-transform-block-scoped-functions/test/fixtures/block-scoped-functions/basic/output.js b/packages/babel-plugin-transform-block-scoped-functions/test/fixtures/block-scoped-functions/basic/output.js new file mode 100644 index 0000000000..3a82ac1587 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoped-functions/test/fixtures/block-scoped-functions/basic/output.js @@ -0,0 +1,6 @@ +{ + let name = function (n) { + return n; + }; +} +name("Steve"); diff --git a/packages/babel-plugin-transform-block-scoped-functions/test/index.js b/packages/babel-plugin-transform-block-scoped-functions/test/index.js new file mode 100644 index 0000000000..1b534b8fc6 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoped-functions/test/index.js @@ -0,0 +1,3 @@ +import runner from "@babel/helper-plugin-test-runner"; + +runner(__dirname);