Skip to content

Commit 7ba1afa

Browse files
authored
Update babel 8 preset env fixtures (#17356)
* test: revert preset-env debug syntax strip The debug test cases have been duplicated anyway * support stdout in generate-babel-7-tests * update test fixtures * add support for stderr
1 parent 7191cdc commit 7ba1afa

File tree

24 files changed

+218
-73
lines changed

24 files changed

+218
-73
lines changed

packages/babel-helper-transform-fixture-test-runner/src/index.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -385,15 +385,7 @@ async function run(task: Test) {
385385
validateFile(
386386
normalizeOutput(actualLogs.stdout, normalizationOpts),
387387
stdout.loc,
388-
process.env.BABEL_8_BREAKING
389-
? // In Babel 8, preset-env does not enable all the unnecessary syntax
390-
// plugins. For simplicity, just strip them fro the expected output
391-
// so that we do not need to separate tests for every fixture.
392-
stdout.code.replace(
393-
/\n\s*syntax-(?!import-attributes|import-assertions).*/g,
394-
"",
395-
)
396-
: stdout.code,
388+
stdout.code,
397389
);
398390
validateFile(
399391
normalizeOutput(actualLogs.stderr, normalizationOpts),
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class A {
2+
#x;
3+
[class {}]
4+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"validateLogs": true,
3+
"targets": {
4+
"chrome": 100
5+
},
6+
"presets": [
7+
[
8+
"env",
9+
{
10+
"debug": true
11+
}
12+
]
13+
],
14+
"BABEL_8_BREAKING": false
15+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class A {
2+
#x;
3+
[class {}];
4+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@babel/preset-env: `DEBUG` option
2+
3+
Using targets:
4+
{
5+
"chrome": "100"
6+
}
7+
8+
Using modules transform: auto
9+
10+
Using plugins:
11+
transform-duplicate-named-capturing-groups-regex { chrome < 126 }
12+
transform-regexp-modifiers { chrome < 125 }
13+
transform-unicode-sets-regex { chrome < 112 }
14+
syntax-class-static-block
15+
syntax-private-property-in-object
16+
syntax-class-properties
17+
syntax-numeric-separator
18+
syntax-nullish-coalescing-operator
19+
syntax-optional-chaining
20+
syntax-json-strings
21+
syntax-optional-catch-binding
22+
syntax-async-generators
23+
syntax-object-rest-spread
24+
transform-export-namespace-from { }
25+
transform-modules-commonjs
26+
transform-dynamic-import
27+
syntax-top-level-await
28+
syntax-import-meta
29+
30+
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"validateLogs": true,
3-
"targets": { "chrome": 100 },
4-
"presets": [["env", { "debug": true }]]
3+
"targets": {
4+
"chrome": 100
5+
},
6+
"presets": [
7+
[
8+
"env",
9+
{
10+
"debug": true
11+
}
12+
]
13+
],
14+
"BABEL_8_BREAKING": true
515
}

packages/babel-preset-env/test/fixtures/bugfixes-always-enabled/class-in-computed-field-chrome-100/stdout.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,8 @@ Using plugins:
1111
transform-duplicate-named-capturing-groups-regex { chrome < 126 }
1212
transform-regexp-modifiers { chrome < 125 }
1313
transform-unicode-sets-regex { chrome < 112 }
14-
syntax-class-static-block
15-
syntax-private-property-in-object
16-
syntax-class-properties
17-
syntax-numeric-separator
18-
syntax-nullish-coalescing-operator
19-
syntax-optional-chaining
20-
syntax-json-strings
21-
syntax-optional-catch-binding
22-
syntax-async-generators
23-
syntax-object-rest-spread
2414
transform-export-namespace-from { }
2515
transform-modules-commonjs
2616
transform-dynamic-import
27-
syntax-top-level-await
28-
syntax-import-meta
2917

3018
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class A {
2+
#x;
3+
[class {}]
4+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"validateLogs": true,
3+
"targets": {
4+
"firefox": 50
5+
},
6+
"presets": [
7+
[
8+
"env",
9+
{
10+
"debug": true
11+
}
12+
]
13+
],
14+
"BABEL_8_BREAKING": false
15+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var _ref;
2+
var _x = /*#__PURE__*/new WeakMap();
3+
_ref = class {};
4+
class A {
5+
constructor() {
6+
babelHelpers.classPrivateFieldInitSpec(this, _x, void 0);
7+
babelHelpers.defineProperty(this, _ref, void 0);
8+
}
9+
}

0 commit comments

Comments
 (0)