44 * SPDX-License-Identifier: MIT
55 * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66 */
7+
8+ // These tests exercise Babel pipelines that cannot be represented as fixture tests.
9+ // Fixture tests run the full forward → main-plugin → class-properties → reverse pipeline,
10+ // but the tests here need one of the following non-standard setups:
11+ // • Forward-only pipeline (transformForwardOnly) — no reverse transform
12+ // • Reverse-only pipeline (transformReverseOnly) — no forward transform
13+ // • Custom intermediate Babel plugin inserted between the forward and reverse transforms
14+
715import { describe , expect , test } from 'vitest' ;
816import { transformSync } from '@babel/core' ;
917import plugin , { LwcPrivateMethodTransform , LwcReversePrivateMethodTransform } from '../index' ;
@@ -46,7 +54,6 @@ function transformForwardOnly(source: string, opts = {}) {
4654}
4755
4856describe ( 'private method transform validation' , ( ) => {
49- // Kept inline: uses reverse-only pipeline (no forward transform)
5057 test ( 'reverse standalone on clean code succeeds without forward metadata' , ( ) => {
5158 const source = `
5259 class Test {
@@ -58,7 +65,6 @@ describe('private method transform validation', () => {
5865 expect ( result . code ) . toContain ( 'publicMethod' ) ;
5966 } ) ;
6067
61- // Kept inline: uses reverse-only pipeline (no forward transform)
6268 test ( 'reverse standalone with prefixed method throws collision when metadata is missing' , ( ) => {
6369 const source = `
6470 class Test {
@@ -71,7 +77,6 @@ describe('private method transform validation', () => {
7177 ) ;
7278 } ) ;
7379
74- // Kept inline: uses custom intermediate Babel plugin in a 4-plugin pipeline
7580 test ( 'Program.exit count mismatch throws when forward-transformed method is removed' , ( ) => {
7681 const PREFIX = '__lwc_component_class_internal_private_' ;
7782
@@ -111,7 +116,6 @@ describe('private method transform validation', () => {
111116 ) . toThrowError ( / P r i v a t e m e t h o d t r a n s f o r m c o u n t m i s m a t c h / ) ;
112117 } ) ;
113118
114- // Kept inline: uses forward-only pipeline (no reverse transform)
115119 test ( 'forward-only output contains correct prefixed names' , ( ) => {
116120 const source = `
117121 import { LightningElement } from 'lwc';
@@ -128,7 +132,6 @@ describe('private method transform validation', () => {
128132 expect ( result . code ) . not . toContain ( '#bar' ) ;
129133 } ) ;
130134
131- // Kept inline: uses custom intermediate Babel plugin in a 4-plugin pipeline
132135 test ( 'intermediate plugin that modifies method body does not break reverse transform' , ( ) => {
133136 function bodyModifierPlugin ( { types : t } : any ) {
134137 return {
@@ -176,7 +179,6 @@ describe('private method transform validation', () => {
176179 expect ( result . code ) . not . toContain ( '__lwc_component_class_internal_private_' ) ;
177180 } ) ;
178181
179- // Kept inline: uses custom intermediate Babel plugin in a 4-plugin pipeline
180182 test ( 'intermediate plugin that adds a prefixed method triggers collision' , ( ) => {
181183 function prefixedMethodInjectorPlugin ( { types : t } : any ) {
182184 let injected = false ;
@@ -218,7 +220,6 @@ describe('private method transform validation', () => {
218220 ) . toThrowError ( / c a n n o t s t a r t w i t h r e s e r v e d p r e f i x ` _ _ l w c _ ` / ) ;
219221 } ) ;
220222
221- // Kept inline: uses forward-only pipeline (no reverse transform)
222223 test ( 'forward-only output transforms call sites to prefixed names' , ( ) => {
223224 const source = `
224225 import { LightningElement } from 'lwc';
@@ -237,7 +238,6 @@ describe('private method transform validation', () => {
237238 expect ( code ) . not . toContain ( 'this.#doWork' ) ;
238239 } ) ;
239240
240- // Kept inline: uses forward-only pipeline (no reverse transform)
241241 test ( 'forward references in call sites are transformed' , ( ) => {
242242 const source = `
243243 import { LightningElement } from 'lwc';
@@ -259,7 +259,6 @@ describe('private method transform validation', () => {
259259 expect ( roundTrip . code ) . not . toContain ( '__lwc_component_class_internal_private_' ) ;
260260 } ) ;
261261
262- // Kept inline: uses forward-only pipeline to verify occurrence counts
263262 test ( 'multiple invocations of the same private method are all transformed' , ( ) => {
264263 const source = `
265264 import { LightningElement } from 'lwc';
@@ -286,7 +285,6 @@ describe('private method transform validation', () => {
286285 expect ( privateMatches ) . toHaveLength ( 4 ) ;
287286 } ) ;
288287
289- // Kept inline: uses forward-only pipeline (no reverse transform)
290288 test ( 'cross-method private call sites in forward-only output' , ( ) => {
291289 const source = `
292290 import { LightningElement } from 'lwc';
0 commit comments