From bc038ec7290df8f2659142a3c9119c7a28172c7f Mon Sep 17 00:00:00 2001 From: Dunqing Date: Wed, 25 Dec 2024 12:56:12 +0800 Subject: [PATCH] feat(transformer/class-properties): transform private field expression which refers to private method --- .../es2022/class_properties/private_field.rs | 40 +- .../snapshots/babel.snap.md | 10 +- .../snapshots/babel_exec.snap.md | 486 +----------------- .../snapshots/oxc_exec.snap.md | 14 +- 4 files changed, 35 insertions(+), 515 deletions(-) diff --git a/crates/oxc_transformer/src/es2022/class_properties/private_field.rs b/crates/oxc_transformer/src/es2022/class_properties/private_field.rs index 85270a563ef6a7..e2e3f22c079125 100644 --- a/crates/oxc_transformer/src/es2022/class_properties/private_field.rs +++ b/crates/oxc_transformer/src/es2022/class_properties/private_field.rs @@ -60,11 +60,18 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { is_declaration, } = self.classes_stack.find_private_prop(&field_expr.field); + let span = field_expr.span; + if is_method || is_accessor { - return None; + let prop_ident = prop_binding.create_read_expression(ctx); + return if is_assignment { + // TODO: Handle assignment to private method or accessor + None + } else { + Some(self.create_assert_class_brand_for_private_method(prop_ident, span, ctx)) + }; }; - let span = field_expr.span; let object = ctx.ast.move_expression(&mut field_expr.object); if self.private_fields_as_properties { @@ -268,11 +275,12 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { is_declaration, } = self.classes_stack.find_private_prop(&field_expr.field); + let span = field_expr.span; let prop_ident = prop_binding.create_read_expression(ctx); if is_method || is_accessor { return ( - self.create_assert_class_brand_for_private_method(prop_ident, ctx), + self.create_assert_class_brand_for_private_method(prop_ident, span, ctx), ctx.ast.expression_this(SPAN), ); }; @@ -301,8 +309,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { .is_some() { // `_prop._` - let callee = - Self::create_underscore_member_expression(prop_ident, field_expr.span, ctx); + let callee = Self::create_underscore_member_expression(prop_ident, span, ctx); (callee, object) } else { let class_binding = class_bindings.get_or_init_static_binding(ctx); @@ -316,7 +323,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { class_ident, object1, prop_ident, - field_expr.span, + span, ctx, ); (assert_obj, object2) @@ -327,7 +334,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { let (object1, object2) = self.duplicate_object(object, ctx); // `_classPrivateFieldGet2(_prop, object)` - let get_call = self.create_private_field_get(prop_ident, object1, field_expr.span, ctx); + let get_call = self.create_private_field_get(prop_ident, object1, span, ctx); (get_call, object2) }; @@ -533,7 +540,8 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { // Replace right side of assignment with `_assertClassBrand(Class, object, _prop)` // TODO: Ensure there are tests for nested classes with references to private static props // of outer class inside inner class, to make sure we're getting the right `class_binding`. - assign_expr.right = self.create_assert_class_brand(class_ident, object, value, ctx); + assign_expr.right = + self.create_assert_class_brand(class_ident, object, value, SPAN, ctx); } else { let class_ident = class_binding.create_read_expression(ctx); let value = ctx.ast.move_expression(&mut assign_expr.right); @@ -563,7 +571,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { let value = ctx.ast.expression_binary(SPAN, get_expr, operator, value); // `_assertClassBrand(Class, object, _assertClassBrand(Class, object, _prop)._ + value)` assign_expr.right = - self.create_assert_class_brand(class_ident2, object1, value, ctx); + self.create_assert_class_brand(class_ident2, object1, value, SPAN, ctx); } else if let Some(operator) = operator.to_logical_operator() { // `object.#prop &&= value` // -> `_assertClassBrand(Class, object, _prop)._ && (_prop._ = _assertClassBrand(Class, object, value))` @@ -585,7 +593,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { assign_expr.span = SPAN; assign_expr.operator = AssignmentOperator::Assign; assign_expr.right = - self.create_assert_class_brand(class_ident2, object2, value, ctx); + self.create_assert_class_brand(class_ident2, object2, value, SPAN, ctx); let right = ctx.ast.move_expression(expr); // `_assertClassBrand(Class, object, _prop)._ && (_prop._ = _assertClassBrand(Class, object, value))` *expr = ctx.ast.expression_logical(span, left, operator, right); @@ -869,7 +877,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { // If no shortcut, wrap in `_assertClassBrand(Class, object, )` if let Some(class_ident) = class_ident { - value = self.create_assert_class_brand(class_ident, object, value, ctx); + value = self.create_assert_class_brand(class_ident, object, value, SPAN, ctx); } // `_prop._ = ` @@ -899,7 +907,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { // If no shortcut, wrap in `_assertClassBrand(Class, object, )` if let Some(class_ident) = class_ident { - value = self.create_assert_class_brand(class_ident, object, value, ctx); + value = self.create_assert_class_brand(class_ident, object, value, SPAN, ctx); } // `_prop._ = ` @@ -1772,11 +1780,12 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { class_ident: Expression<'a>, object: Expression<'a>, value_or_prop_ident: Expression<'a>, + span: Span, ctx: &mut TraverseCtx<'a>, ) -> Expression<'a> { self.ctx.helper_call_expr( Helper::AssertClassBrand, - SPAN, + span, ctx.ast.vec_from_array([ Argument::from(class_ident), Argument::from(object), @@ -1791,11 +1800,12 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { fn create_assert_class_brand_for_private_method( &self, value_or_prop_ident: Expression<'a>, + span: Span, ctx: &mut TraverseCtx<'a>, ) -> Expression<'a> { let class_ident = self.current_class().bindings.brand().create_read_expression(ctx); let object = ctx.ast.expression_this(SPAN); - self.create_assert_class_brand(class_ident, object, value_or_prop_ident, ctx) + self.create_assert_class_brand(class_ident, object, value_or_prop_ident, span, ctx) } /// `_assertClassBrand(Class, object, _prop)._` @@ -1807,7 +1817,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { span: Span, ctx: &mut TraverseCtx<'a>, ) -> Expression<'a> { - let func_call = self.create_assert_class_brand(class_ident, object, prop_ident, ctx); + let func_call = self.create_assert_class_brand(class_ident, object, prop_ident, SPAN, ctx); Self::create_underscore_member_expression(func_call, span, ctx) } diff --git a/tasks/transform_conformance/snapshots/babel.snap.md b/tasks/transform_conformance/snapshots/babel.snap.md index e7752d07b284d2..61a78ae3bb6fb0 100644 --- a/tasks/transform_conformance/snapshots/babel.snap.md +++ b/tasks/transform_conformance/snapshots/babel.snap.md @@ -1,6 +1,6 @@ commit: 54a8389f -Passed: 628/1095 +Passed: 630/1095 # All Passed: * babel-plugin-transform-logical-assignment-operators @@ -462,7 +462,7 @@ x Output mismatch x Output mismatch -# babel-plugin-transform-private-methods (13/148) +# babel-plugin-transform-private-methods (15/148) * accessors/arguments/input.js x Output mismatch @@ -571,15 +571,9 @@ x Output mismatch * private-method/class-expression/input.js x Output mismatch -* private-method/context/input.js -x Output mismatch - * private-method/destructuring/input.js x Output mismatch -* private-method/exfiltrated/input.js -x Output mismatch - * private-method/read-only/input.js x Output mismatch diff --git a/tasks/transform_conformance/snapshots/babel_exec.snap.md b/tasks/transform_conformance/snapshots/babel_exec.snap.md index df3224a0c7a50e..8820341f83c907 100644 --- a/tasks/transform_conformance/snapshots/babel_exec.snap.md +++ b/tasks/transform_conformance/snapshots/babel_exec.snap.md @@ -1,486 +1,8 @@ commit: 54a8389f node: v22.12.0 +filter: fixtures/babel +include: **/*.{test,spec}.?(c|m)[jt]s?(x) +exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*, "" -Passed: 225 of 362 (62.15%) - -Failures: - -./fixtures/babel/babel-plugin-transform-arrow-functions-test-fixtures-arrow-functions-implicit-var-arguments-exec.test.js -'eval' and 'arguments' cannot be used as a binding identifier in strict mode - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-assumption-setPublicClassFields-static-infer-name-exec.test.js -AssertionError: expected '_Class' to be 'Foo' // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-assumption-setPublicClassFields-static-infer-name-exec.test.js:8:19 - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-nested-class-super-call-in-decorator-exec.test.js -AssertionError: expected undefined to be 'hello' // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-nested-class-super-call-in-decorator-exec.test.js:21:28 - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-nested-class-super-property-in-accessor-key-exec.test.js -Unexpected token `[`. Expected * for generator, private key, identifier or async - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-nested-class-super-property-in-decorator-exec.test.js -AssertionError: expected undefined to be 'hello' // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-nested-class-super-property-in-decorator-exec.test.js:22:28 - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-optional-chain-in-function-param-with-transform-exec.test.js -TypeError: Cannot convert undefined or null to object - at hasOwnProperty () - at _classPrivateFieldBase (./node_modules/.pnpm/@babel+runtime@7.26.0/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js:2:26) - at value (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-optional-chain-in-function-param-with-transform-exec.test.js:63:11) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-optional-chain-in-function-param-with-transform-exec.test.js:44:198 - at j (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-optional-chain-in-function-param-with-transform-exec.test.js:45:6) - at Function.test (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-optional-chain-in-function-param-with-transform-exec.test.js:52:11) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-optional-chain-in-function-param-with-transform-exec.test.js:71:6 - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-optional-chain-member-optional-call-with-transform-exec.test.js -TypeError: Cannot convert undefined or null to object - at hasOwnProperty () - at _classPrivateFieldBase (./node_modules/.pnpm/@babel+runtime@7.26.0/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js:2:26) - at value (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-optional-chain-member-optional-call-with-transform-exec.test.js:123:11) - at Function.test (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-optional-chain-member-optional-call-with-transform-exec.test.js:24:134) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-optional-chain-member-optional-call-with-transform-exec.test.js:131:6 - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-parenthesized-optional-member-call-exec.test.js -TypeError: Cannot read properties of undefined (reading 'bind') - at Foo.test (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-parenthesized-optional-member-call-exec.test.js:20:59) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-parenthesized-optional-member-call-exec.test.js:78:12 - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-parenthesized-optional-member-call-with-transform-exec.test.js -TypeError: Cannot read properties of undefined (reading 'bind') - at Foo.test (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-parenthesized-optional-member-call-with-transform-exec.test.js:20:59) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-loose-parenthesized-optional-member-call-with-transform-exec.test.js:78:12 - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-static-self-method-exec.test.js -Private field '#bar' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-static-shadow-exec.test.js -TypeError: e.has is not a function - at _assertClassBrand (./node_modules/.pnpm/@babel+runtime@7.26.0/node_modules/@babel/runtime/helpers/assertClassBrand.js:2:44) - at func (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-static-shadow-exec.test.js:10:12) - at Function.method (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-static-shadow-exec.test.js:12:11) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-private-static-shadow-exec.test.js:16:14 - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-public-computed-toPrimitive-exec.test.js -AssertionError: expected [Function] to throw error including '@@toPrimitive must return a primitive…' but got 'Cannot convert object to primitive va…' - at Proxy. (./node_modules/.pnpm/@vitest+expect@2.1.2/node_modules/@vitest/expect/dist/index.js:1438:21) - at Proxy. (./node_modules/.pnpm/@vitest+expect@2.1.2/node_modules/@vitest/expect/dist/index.js:923:17) - at Proxy.methodWrapper (./node_modules/.pnpm/chai@5.1.2/node_modules/chai/chai.js:1610:25) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-public-computed-toPrimitive-exec.test.js:37:5 - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-public-delete-super-property-exec.test.js -AssertionError: expected function to throw an error, but it didn't - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-public-delete-super-property-exec.test.js:25:5 - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-public-loose-static-infer-name-exec.test.js -AssertionError: expected '_Class' to be 'Foo' // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-public-loose-static-infer-name-exec.test.js:8:19 - -./fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-public-static-infer-name-exec.test.js -AssertionError: expected '_Class' to be 'Foo' // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-properties-test-fixtures-public-static-infer-name-exec.test.js:9:19 - -./fixtures/babel/babel-plugin-transform-class-static-block-test-fixtures-integration-loose-private-in-exec.test.js -Private field '#bar' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-class-static-block-test-fixtures-integration-loose-private-methods-access-exec.test.js -Private field '#foo' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-class-static-block-test-fixtures-integration-new-target-exec.test.js -AssertionError: expected [Function Base] to be undefined // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-static-block-test-fixtures-integration-new-target-exec.test.js:10:29 - -./fixtures/babel/babel-plugin-transform-class-static-block-test-fixtures-integration-private-in-exec.test.js -Private field '#bar' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-class-static-block-test-fixtures-integration-private-methods-access-exec.test.js -ReferenceError: _Foo_brand is not defined - at getFoo (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-static-block-test-fixtures-integration-private-methods-access-exec.test.js:17:35) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-class-static-block-test-fixtures-integration-private-methods-access-exec.test.js:18:9 - -./fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-assumption-noDocumentAll-parenthesized-expression-member-call-exec.test.js -TypeError: Cannot read properties of undefined (reading 'x') - at m (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-assumption-noDocumentAll-parenthesized-expression-member-call-exec.test.js:10:16) - at Foo.test (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-assumption-noDocumentAll-parenthesized-expression-member-call-exec.test.js:25:63) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-assumption-noDocumentAll-parenthesized-expression-member-call-exec.test.js:68:12 - -./fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-general-parenthesized-expression-member-call-exec.test.js -TypeError: Cannot read properties of undefined (reading 'x') - at m (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-general-parenthesized-expression-member-call-exec.test.js:10:16) - at Foo.test (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-general-parenthesized-expression-member-call-exec.test.js:25:63) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-general-parenthesized-expression-member-call-exec.test.js:68:12 - -./fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-general-parenthesized-expression-member-call-loose-exec.test.js -TypeError: Cannot read properties of undefined (reading 'x') - at m (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-general-parenthesized-expression-member-call-loose-exec.test.js:10:16) - at Foo.test (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-general-parenthesized-expression-member-call-loose-exec.test.js:25:63) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-optional-chaining-test-fixtures-general-parenthesized-expression-member-call-loose-exec.test.js:68:12 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-arguments-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-basic-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-class-binding-exec.test.js -Private field '#getA' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-get-only-setter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-helper-exec.test.js -Private field '#foo' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-basic-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-class-binding-exec.test.js -Private field '#getA' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-get-only-setter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-helper-exec.test.js -Private field '#foo' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-reassignment-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-set-only-getter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-updates-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-basic-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-class-binding-exec.test.js -Private field '#getA' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-get-only-setter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-helper-exec.test.js -Private field '#foo' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-set-only-getter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-updates-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsSymbols-basic-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsSymbols-class-binding-exec.test.js -Private field '#getA' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsSymbols-get-only-setter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsSymbols-helper-exec.test.js -Private field '#foo' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsSymbols-set-only-getter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsSymbols-updates-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-reassignment-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-set-only-getter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-updates-bigint-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-updates-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-class-binding-exec.test.js -AssertionError: expected null to be [Function A] // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-class-binding-exec.test.js:20:28 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-context-exec.test.js -Private field '#getStatus' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-exfiltrated-exec.test.js -Private field '#privateMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-assignment-exec.test.js -Private field '#privateMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-before-fields-exec.test.js -Private field '#method' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-class-binding-exec.test.js -Private field '#getA' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-context-exec.test.js -Private field '#getStatus' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-exfiltrated-exec.test.js -Private field '#privateMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-generator-exec.test.js -Private field '#foo' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-reassignment-exec.test.js -Private field '#privateMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-super-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-assignment-exec.test.js -Private field '#privateMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-before-fields-exec.test.js -Private field '#method' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-class-binding-exec.test.js -Private field '#getA' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-context-exec.test.js -Private field '#getStatus' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-exfiltrated-exec.test.js -Private field '#privateMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-generator-exec.test.js -Private field '#foo' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-super-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsSymbols-class-binding-exec.test.js -AssertionError: expected null to be [Function A] // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsSymbols-class-binding-exec.test.js:20:28 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsSymbols-context-exec.test.js -Private field '#getStatus' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsSymbols-exfiltrated-exec.test.js -Private field '#privateMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsSymbols-super-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-read-only-exec.test.js -Private field '#method' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-reassignment-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-super-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-basic-exec.test.js -ReferenceError: _Cl_brand is not defined - at new Cl (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-basic-exec.test.js:21:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-basic-exec.test.js:28:9 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-class-check-exec.test.js -ReferenceError: _Cl_brand is not defined - at new Cl (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-class-check-exec.test.js:8:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-class-check-exec.test.js:17:13 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-exfiltrated-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-generator-exec.test.js -ReferenceError: _Cl_brand is not defined - at new Cl (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-generator-exec.test.js:8:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-generator-exec.test.js:18:14 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-basic-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-class-check-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-exfiltrated-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-generator-exec.test.js -Private field '#foo' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-reassignment-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-scopable-exec.test.js -Private field '#privateMethodA' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-super-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-this-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-basic-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-class-check-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-exfiltrated-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-generator-exec.test.js -Private field '#foo' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-reassignment-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-scopable-exec.test.js -Private field '#privateMethodA' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-super-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-this-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-basic-exec.test.js -ReferenceError: _Cl_brand is not defined - at new Cl (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-basic-exec.test.js:21:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-basic-exec.test.js:28:9 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-class-check-exec.test.js -ReferenceError: _Cl_brand is not defined - at new Cl (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-class-check-exec.test.js:8:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-class-check-exec.test.js:17:13 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-exfiltrated-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-generator-exec.test.js -ReferenceError: _Cl_brand is not defined - at new Cl (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-generator-exec.test.js:8:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-generator-exec.test.js:18:14 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-reassignment-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-scopable-exec.test.js -ReferenceError: _Cl_brand is not defined - at new Cl (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-scopable-exec.test.js:8:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-scopable-exec.test.js:22:9 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-super-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-this-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-read-only-exec.test.js -Private field '#method' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-reassignment-exec.test.js -Private field '#privateStaticMethod' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-scopable-exec.test.js -ReferenceError: _Cl_brand is not defined - at new Cl (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-scopable-exec.test.js:8:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-scopable-exec.test.js:22:9 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-super-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-tagged-template-exec.test.js -ReferenceError: _Foo_brand is not defined - at Function.getReceiver (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-tagged-template-exec.test.js:11:29) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-tagged-template-exec.test.js:17:13 - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-this-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-access-in-static-field-initializer-exec.test.js -Private field '#p' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-basic-exec.test.js -Private field '#privateStaticFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-destructure-set-exec.test.js -Private field '#p' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-get-only-setter-exec.test.js -Private field '#privateStaticFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-access-in-static-field-initializer-exec.test.js -Private field '#p' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-basic-exec.test.js -Private field '#privateStaticFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-destructure-set-exec.test.js -Private field '#p' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-get-only-setter-exec.test.js -Private field '#privateStaticFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-set-only-getter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-updates-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-access-in-static-field-initializer-exec.test.js -Private field '#p' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-basic-exec.test.js -Private field '#privateStaticFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-destructure-set-exec.test.js -Private field '#p' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-get-only-setter-exec.test.js -Private field '#privateStaticFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-set-only-getter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-updates-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsSymbols-access-in-static-field-initializer-exec.test.js -Private field '#p' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsSymbols-basic-exec.test.js -Private field '#privateStaticFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsSymbols-destructure-set-exec.test.js -Private field '#p' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsSymbols-get-only-setter-exec.test.js -Private field '#privateStaticFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsSymbols-set-only-getter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsSymbols-updates-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-set-only-getter-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-updates-exec.test.js -Private field '#privateFieldValue' must be declared in an enclosing class - -./fixtures/babel/babel-preset-env-test-fixtures-plugins-integration-issue-15170-exec.test.js -AssertionError: expected [Function] to not throw an error but 'ReferenceError: x is not defined' was thrown - at Proxy. (./node_modules/.pnpm/@vitest+expect@2.1.2/node_modules/@vitest/expect/dist/index.js:1438:21) - at Proxy. (./node_modules/.pnpm/@vitest+expect@2.1.2/node_modules/@vitest/expect/dist/index.js:923:17) - at Proxy.methodWrapper (./node_modules/.pnpm/chai@5.1.2/node_modules/chai/chai.js:1610:25) - at ./tasks/transform_conformance/fixtures/babel/babel-preset-env-test-fixtures-plugins-integration-issue-15170-exec.test.js:6:9 - -./fixtures/babel/babel-preset-env-test-fixtures-sanity-check-es2015-constants-exec.test.js -TypeError: Assignment to constant variable. - at ./tasks/transform_conformance/fixtures/babel/babel-preset-env-test-fixtures-sanity-check-es2015-constants-exec.test.js:5:6 - -./fixtures/babel/babel-preset-env-test-fixtures-sanity-regex-dot-all-exec.test.js -AssertionError: expected false to be true // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-preset-env-test-fixtures-sanity-regex-dot-all-exec.test.js:10:37 +No test files found, exiting with code 1 diff --git a/tasks/transform_conformance/snapshots/oxc_exec.snap.md b/tasks/transform_conformance/snapshots/oxc_exec.snap.md index f2c7e0b449cf4e..1c3b4e2a74fc8a 100644 --- a/tasks/transform_conformance/snapshots/oxc_exec.snap.md +++ b/tasks/transform_conformance/snapshots/oxc_exec.snap.md @@ -1,14 +1,8 @@ commit: 54a8389f node: v22.12.0 +filter: fixtures/oxc +include: **/*.{test,spec}.?(c|m)[jt]s?(x) +exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*, "" -Passed: 3 of 5 (60.00%) - -Failures: - -./fixtures/oxc/babel-plugin-transform-class-properties-test-fixtures-private-field-resolve-to-method-in-computed-key-exec.test.js -Private field '#shadowed' must be declared in an enclosing class - -./fixtures/oxc/babel-plugin-transform-class-properties-test-fixtures-static-super-tagged-template-exec.test.js -AssertionError: expected undefined to be [Function C] // Object.is equality - at ./tasks/transform_conformance/fixtures/oxc/babel-plugin-transform-class-properties-test-fixtures-static-super-tagged-template-exec.test.js:15:17 +No test files found, exiting with code 1