diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/auxiliary-comment/options.json b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/auxiliary-comment/options.json new file mode 100644 index 0000000000..c3733ea44e --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/auxiliary-comment/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["external-helpers-2", "transform-es2015-modules-commonjs"], + "auxiliaryCommentBefore": "before", + "auxiliaryCommentAfter": "after" +} diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/auxiliary-comment/overview/actual.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/auxiliary-comment/overview/actual.js new file mode 100644 index 0000000000..3b32cd0941 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/auxiliary-comment/overview/actual.js @@ -0,0 +1,14 @@ +import "foo"; +import "foo-bar"; +import "./directory/foo-bar"; +import foo from "foo2"; +import * as foo2 from "foo3"; +import {bar} from "foo4"; +import {foo as bar2} from "foo5"; + +export {test}; +export var test = 5; + +bar; +bar2; +foo; diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/auxiliary-comment/overview/expected.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/auxiliary-comment/overview/expected.js new file mode 100644 index 0000000000..947e8a0b77 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/auxiliary-comment/overview/expected.js @@ -0,0 +1,38 @@ +/*before*/"use strict"; + +/*before*/Object.defineProperty(exports, "__esModule", { + value: true +}); +/*before*/exports.test = undefined; +/*before*/ +require("foo"); + +/*before*/ +require("foo-bar"); + +/*before*/ +require("./directory/foo-bar"); + +/*before*/ +var _foo = require("foo2"); + +/*before*/ +var _foo2 = babelHelpers.interopRequireDefault(_foo); + +/*before*/ +var _foo3 = require("foo3"); + +/*before*/var /*after*/foo2 = babelHelpers.interopRequireWildcard(_foo3); +/*before*/ +var _foo4 = require("foo4"); + +/*before*/ +var _foo5 = require("foo5"); + +/*before*/exports. /*after*/test = test; +var test = /*before*/exports. /*after*/test = 5; + +/*before*/_foo4. /*after*/bar; +/*before*/_foo5. /*after*/foo; +/*before*/_foo2.default; +/*after*/ diff --git a/packages/babel-plugin-transform-strict-mode/test/fixtures/auxiliary-comment/options.json b/packages/babel-plugin-transform-strict-mode/test/fixtures/auxiliary-comment/options.json new file mode 100644 index 0000000000..f630e093d5 --- /dev/null +++ b/packages/babel-plugin-transform-strict-mode/test/fixtures/auxiliary-comment/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["transform-strict-mode", "transform-es2015-modules-commonjs"], + "auxiliaryCommentBefore": "before", + "auxiliaryCommentAfter": "after" +} diff --git a/packages/babel-plugin-transform-strict-mode/test/fixtures/auxiliary-comment/use-strict-add/actual.js b/packages/babel-plugin-transform-strict-mode/test/fixtures/auxiliary-comment/use-strict-add/actual.js new file mode 100644 index 0000000000..a280f9a5cc --- /dev/null +++ b/packages/babel-plugin-transform-strict-mode/test/fixtures/auxiliary-comment/use-strict-add/actual.js @@ -0,0 +1 @@ +foo(); diff --git a/packages/babel-plugin-transform-strict-mode/test/fixtures/auxiliary-comment/use-strict-add/expected.js b/packages/babel-plugin-transform-strict-mode/test/fixtures/auxiliary-comment/use-strict-add/expected.js new file mode 100644 index 0000000000..ffb737e4d9 --- /dev/null +++ b/packages/babel-plugin-transform-strict-mode/test/fixtures/auxiliary-comment/use-strict-add/expected.js @@ -0,0 +1,3 @@ +/*before*/"use strict"; + +/*after*/foo();