Skip to content

test(ts-plugin): split find-all-references and rename-symbol e2e tests into per-behavior cases#379

Merged
mizdra merged 3 commits into
mainfrom
test/e2e-test-references-and-rename
May 3, 2026
Merged

test(ts-plugin): split find-all-references and rename-symbol e2e tests into per-behavior cases#379
mizdra merged 3 commits into
mainfrom
test/e2e-test-references-and-rename

Conversation

@mizdra
Copy link
Copy Markdown
Owner

@mizdra mizdra commented May 3, 2026

Summary

Continue the e2e test refactor started in #378. Each test now owns a minimal fixture and asserts a single behavior, organized by the .d.ts/mapping pattern under test. This PR also revisits go-to-definition.test.ts so all three feature test files share the same describe structure.

This is the second PR of a multi-PR series (see #378 for the first PR / overall context).

What's new

  • packages/ts-plugin/e2e-test/feature/find-all-references.test.ts: rewritten as 11 behavior-focused tests organized into 5 describe blocks, each with its own minimal fixture (was 17 cases sharing one fixture in a single test.each).
  • packages/ts-plugin/e2e-test/feature/rename-symbol.test.ts: rewritten as 10 behavior-focused tests organized into 4 describe blocks, each with its own minimal fixture (was 13 cases sharing one fixture in a single test.each). Now also covers namedExports: true via describe.each (previously only namedExports: false).
  • packages/ts-plugin/e2e-test/feature/go-to-definition.test.ts (existing from refactor(ts-plugin): split go-to-definition e2e tests into per-behavior cases #378): renamed a_alias to b_alias so the alias name reflects its source token, and added a new "CSS-side class declaration" test so all three files share the same group structure.

Shared describe structure

All three files share the same group layout (group 1 differs by feature):

namedExports: $namedExports
├── (group 1: feature-specific Volar.js auto-mapping)
│   - go-to-definition:   jumps to the top of a CSS module file (5 tests)
│   - find-all-references: finds all references to the styles binding (1 test)
│   - rename-symbol:       — (no equivalent: module specifier rename is
│                            `sendGetEditsForFileRename` territory and styles
│                            binding rename is core TS behavior)
├── <feature> a local token (TS-side trigger, 3 tests)
│   ├── from styles.<token> access
│   ├── from styles[<kebab-case token>] access
│   └── returns all declarations when the same class is declared multiple times
├── transitively resolves a re-export to its source declaration (3 tests)
│   ├── class re-exported via @import
│   ├── value re-exported via @value ... from
│   └── aliased value re-exported via @value ... from
├── <feature> from a CSS-side class declaration (1 test, newly added)
│   └── from a .<token> declaration
└── <feature> from a CSS-side @value ... from binding (3 tests)
    ├── from the import binding
    ├── from the alias name in `name as alias`
    └── from the source name in `name as alias`

Per-file totals:

  • go-to-definition: 15 tests × 2 variants = 30
  • find-all-references: 11 tests × 2 variants = 22
  • rename-symbol: 10 tests × 2 variants = 20

Test plan

  • vp test --project e2e packages/ts-plugin/e2e-test/feature/find-all-references.test.ts — 22 passed
  • vp test --project e2e packages/ts-plugin/e2e-test/feature/rename-symbol.test.ts — 20 passed
  • vp test --project e2e packages/ts-plugin/e2e-test/feature/go-to-definition.test.ts — 30 passed
  • vp test --project e2e (full e2e suite) — no regressions
  • vp check (format + lint + type) — pass

…s into per-behavior cases

Continue the e2e test refactor started in #378. Each test now owns a minimal
fixture and asserts a single behavior, organized by the .d.ts/mapping pattern
under test. Also revisit go-to-definition.test.ts so all three feature test
files share the same describe structure.

This is the second PR of a multi-PR series (see #378 for the first PR).

Shared describe structure (group 1 differs by feature, groups 2-5 are common):

- Group 1: feature-specific Volar.js auto-mapping
  - go-to-definition: jumps to the top of a CSS module file (5 tests)
  - find-all-references: finds all references to the styles binding (1 test)
  - rename-symbol: (none — module specifier rename is sendGetEditsForFileRename
    territory and styles binding rename is core TS behavior, not ts-plugin's)
- Group 2: <feature> a local token (TS-side trigger, 3 tests)
- Group 3: transitively resolves a re-export to its source declaration (3 tests)
- Group 4: <feature> from a CSS-side class declaration (1 test, newly added)
- Group 5: <feature> from a CSS-side @value ... from binding (3 tests)

Per-file totals:
- go-to-definition: 15 tests x 2 namedExports variants = 30
- find-all-references: 11 tests x 2 namedExports variants = 22
  (was 17 cases sharing one fixture inside a single test.each)
- rename-symbol: 10 tests x 2 namedExports variants = 20
  (was 13 cases inside a single test.each, only namedExports: false)

rename-symbol now also covers namedExports: true via describe.each.
@mizdra mizdra added the Type: Testing Adding missing tests or correcting existing tests label May 3, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 3, 2026

⚠️ No Changeset found

Latest commit: f98bc5a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

mizdra and others added 2 commits May 4, 2026 00:20
Other test names in the same describe blocks describe a trigger position
or fixture shape (e.g. "from styles.<token> access"), but this one was
phrased as a result ("returns all declarations ..."). Drop the verb so
the name reads as a scenario qualifier on the parent describe and stays
consistent across all three feature files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mizdra mizdra merged commit 65a8f15 into main May 3, 2026
20 checks passed
@mizdra mizdra deleted the test/e2e-test-references-and-rename branch May 3, 2026 15:55
mizdra added a commit that referenced this pull request May 4, 2026
…avior cases (#380)

* test(ts-plugin): split completion and code-fix e2e tests into per-behavior cases

Refactor both test files so each `test` block owns a minimal fixture and
asserts a single behavior, organized by the .d.ts/mapping pattern under
test. Follows the structure established in #378 and #379.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(ts-plugin): drop unused JSX compilerOptions from styles priority test

The fixture only contains `styles;` and never renders any JSX, so the
`jsx` and `types` compilerOptions are not needed for that test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(ts-plugin): cover named token suppression when prioritizeNamedImports is false

Add the negative-side cases for the `namedExports: true && !prioritizeNamedImports`
branches so that both the positive (current `prioritizeNamedImports: true`)
and negative behaviors of the suppression logic are pinned:

- completion: named tokens are filtered out of suggestions
- code-fix: named import code fixes are excluded

Reorganize the existing `prioritizeNamedImports (namedExports: true)` describe
into two parallel `prioritizeNamedImports: false / true` blocks under a single
parent so the on/off pair is visually adjacent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(ts-plugin): drop redundant (default) suffix from describe names

`prioritizeNamedImports: false` already conveys the configured value;
the `(default)` annotation is redundant and risks going stale if the
default changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(ts-plugin): cover generated-file exclusion and multi-import fixMissingCSSRule

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(ts-plugin): cover both PROPERTY_DOES_NOT_EXIST diagnostics in fixMissingCSSRule

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Testing Adding missing tests or correcting existing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant