Skip to content

Commit 4d60549

Browse files
committed
test: replace per-test comments with top-of-file blurb
Consolidate the individual "Kept inline" comments into a single explanatory note at the top of the file describing why these tests cannot be fixture tests. Made-with: Cursor
1 parent f024518 commit 4d60549

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

packages/@lwc/babel-plugin-component/src/__tests__/private-method-transform.spec.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
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+
715
import { describe, expect, test } from 'vitest';
816
import { transformSync } from '@babel/core';
917
import plugin, { LwcPrivateMethodTransform, LwcReversePrivateMethodTransform } from '../index';
@@ -46,7 +54,6 @@ function transformForwardOnly(source: string, opts = {}) {
4654
}
4755

4856
describe('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(/Private method transform count mismatch/);
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(/cannot start with reserved prefix `__lwc_`/);
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

Comments
 (0)