diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/input.js b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/input.js new file mode 100644 index 000000000000..cb943a888135 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/input.js @@ -0,0 +1,10 @@ +class A { + #x; +} + +class B { + #x; + #y() { + this.#x; + } +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/options.json new file mode 100644 index 000000000000..902656926d49 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/options.json @@ -0,0 +1,8 @@ +{ + "BABEL_8_BREAKING": false, + "validateLogs": true, + "targets": "node 12.0", + "presets": [ + ["env", { "debug": true }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/output.js b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/output.js new file mode 100644 index 000000000000..e31fc7c96568 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/output.js @@ -0,0 +1,22 @@ +class A { + #x; +} + +var _x = /*#__PURE__*/new WeakMap(); + +var _y = /*#__PURE__*/new WeakSet(); + +class B { + constructor() { + babelHelpers.classPrivateMethodInitSpec(this, _y); + babelHelpers.classPrivateFieldInitSpec(this, _x, { + writable: true, + value: void 0 + }); + } + +} + +function _y2() { + babelHelpers.classPrivateFieldGet(this, _x); +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/stdout.txt b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/stdout.txt new file mode 100644 index 000000000000..c5bba3f84935 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12-babel-7/stdout.txt @@ -0,0 +1,27 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "node": "12" +} + +Using modules transform: auto + +Using plugins: + proposal-class-static-block { node < 16.11 } + proposal-private-property-in-object { node < 16.9 } + syntax-class-properties + proposal-private-methods { node < 14.6 } + proposal-numeric-separator { node < 12.5 } + proposal-logical-assignment-operators { node < 15 } + proposal-nullish-coalescing-operator { node < 14 } + proposal-optional-chaining { node < 16.9 } + syntax-json-strings + syntax-optional-catch-binding + syntax-async-generators + syntax-object-rest-spread + proposal-export-namespace-from { node < 13.2 } + transform-modules-commonjs + proposal-dynamic-import + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12/options.json index 4a5669af3d79..d933b5a2c2ac 100644 --- a/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12/options.json +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12/options.json @@ -1,6 +1,7 @@ { + "BABEL_8_BREAKING": true, "validateLogs": true, - "targets": "node 12", + "targets": "node 12.0", "presets": [ ["env", { "debug": true }] ] diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12/stdout.txt b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12/stdout.txt index b027a5f8523c..f580ef19f1c4 100644 --- a/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/class-features-node-12/stdout.txt @@ -2,7 +2,7 @@ Using targets: { - "node": "12.22" + "node": "12" } Using modules transform: auto @@ -12,7 +12,7 @@ Using plugins: proposal-private-property-in-object { node < 16.9 } syntax-class-properties proposal-private-methods { node < 14.6 } - syntax-numeric-separator + proposal-numeric-separator { node < 12.5 } proposal-logical-assignment-operators { node < 15 } proposal-nullish-coalescing-operator { node < 14 } proposal-optional-chaining { node < 14 }