Skip to content

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

Merged
mizdra merged 6 commits into
mainfrom
test/e2e-test-completion-and-code-fix
May 4, 2026
Merged

test(ts-plugin): split completion and code-fix e2e tests into per-behavior cases#380
mizdra merged 6 commits into
mainfrom
test/e2e-test-completion-and-code-fix

Conversation

@mizdra
Copy link
Copy Markdown
Owner

@mizdra mizdra commented May 4, 2026

Summary

Refactor packages/ts-plugin/e2e-test/feature/completion.test.ts and packages/ts-plugin/e2e-test/feature/code-fix.test.ts so that each test block owns a minimal fixture and asserts a single behavior, organized by the .d.ts/mapping pattern under test.

This is the 3rd PR of a multi-PR series (see #378 for the first PR / overall context, #379 for the previous PR).

What's new

  • packages/ts-plugin/e2e-test/feature/completion.test.ts: rewritten as 11 behavior-focused tests organized into 3 describe blocks, each with its own minimal fixture.
  • packages/ts-plugin/e2e-test/feature/code-fix.test.ts: rewritten as 11 behavior-focused tests organized into 3 describe blocks, each with its own minimal fixture.
  • Added negative-side coverage for the namedExports: true && !prioritizeNamedImports branches:
    • completion: named tokens are filtered out of suggestions
    • code-fix: named import code fixes are excluded
  • The two prioritizeNamedImports cases (on/off) are now siblings under a single parent describe so the pair is visually adjacent.

Test structure

completion.test.ts:

namedExports: $namedExports
├── styles binding suggestion (2 tests)
│   ├── prioritizes the CSS module corresponding to the current component file
│   └── inserts the import statement when accepted
└── className attribute snippet (2 tests via test.each)
    ├── quotePreference: single
    └── quotePreference: double

named token completion (namedExports: true)
├── prioritizeNamedImports: false (1 test)
│   └── omits named tokens from suggestions
└── prioritizeNamedImports: true (2 tests)
    ├── omits the default styles binding from suggestions
    └── suggests named token bindings

code-fix.test.ts:

namedExports: $namedExports
├── fixMissingCSSRule (2 tests)
│   ├── inserts a new CSS rule into an empty CSS module
│   └── appends a new CSS rule to a non-empty CSS module
└── auto-import (2 tests)
    ├── inserts the import statement when accepted
    └── excludes generated files from suggestions

named import code fix (namedExports: true)
├── prioritizeNamedImports: false (1 test)
│   └── omits the named import code fix
└── prioritizeNamedImports: true (2 tests)
    ├── omits the default styles binding code fix
    └── suggests a named import code fix

Total: 11 tests (completion) + 11 tests (code-fix) = 22 tests.

Test plan

  • vp test --project e2e packages/ts-plugin/e2e-test/feature/completion.test.ts packages/ts-plugin/e2e-test/feature/code-fix.test.ts — 22 passed
  • vp test --project e2e (full e2e suite) — no regressions
  • vp check (format + lint + type) — pass

🤖 Generated with Claude Code

mizdra and others added 4 commits May 4, 2026 01:18
…avior 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

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>
…ports 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>
`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>
@mizdra mizdra added the Type: Testing Adding missing tests or correcting existing tests label May 4, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

⚠️ No Changeset found

Latest commit: f55f4bb

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the ts-plugin e2e tests for completion and code-fix into smaller, behavior-focused cases with per-test minimal fixtures, aligning with the ongoing series started in #378/#379.

Changes:

  • Rewrites completion.test.ts into multiple targeted tests grouped by namedExports and prioritizeNamedImports.
  • Rewrites code-fix.test.ts into multiple targeted tests grouped by namedExports and prioritizeNamedImports.
  • Adds negative-branch coverage for the namedExports: true && !prioritizeNamedImports behavior in both completion and code-fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/ts-plugin/e2e-test/feature/completion.test.ts Splits completion e2e coverage into smaller fixtures/tests organized by configuration and behavior.
packages/ts-plugin/e2e-test/feature/code-fix.test.ts Splits code-fix e2e coverage into smaller fixtures/tests organized by configuration and behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/ts-plugin/e2e-test/feature/completion.test.ts
Comment thread packages/ts-plugin/e2e-test/feature/code-fix.test.ts
Comment thread packages/ts-plugin/e2e-test/feature/code-fix.test.ts
@mizdra mizdra marked this pull request as draft May 4, 2026 10:44
mizdra and others added 2 commits May 4, 2026 20:03
…issingCSSRule

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

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mizdra mizdra marked this pull request as ready for review May 4, 2026 11:19
@mizdra mizdra merged commit 4563420 into main May 4, 2026
20 checks passed
@mizdra mizdra deleted the test/e2e-test-completion-and-code-fix branch May 4, 2026 12:12
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.

2 participants