Skip to content

test(ts-plugin): split remaining e2e tests into per-behavior cases#382

Merged
mizdra merged 2 commits into
mainfrom
test/e2e-test-misc-pr5
May 5, 2026
Merged

test(ts-plugin): split remaining e2e tests into per-behavior cases#382
mizdra merged 2 commits into
mainfrom
test/e2e-test-misc-pr5

Conversation

@mizdra
Copy link
Copy Markdown
Owner

@mizdra mizdra commented May 5, 2026

Summary

Refactor the remaining e2e test files so that each test block owns a minimal fixture and asserts a single behavior, completing the multi-PR series started in #378.

This is the final PR of the series (see #378 / #379 / #380 for the per-feature PRs).

What's new

  • packages/ts-plugin/e2e-test/feature/refactor.test.ts: split into 4 behavior-focused tests; added a missing case for "refactor is suppressed when the paired CSS module already exists".
  • packages/ts-plugin/e2e-test/feature/rename-file.test.ts: split into 3 behaviors × 2 namedExports variants = 6 tests, organized by which import syntax gets rewritten.
  • packages/ts-plugin/e2e-test/disabled.test.ts: kept as 1 test; renamed for specificity and switched to setupFixture / getLoc.
  • packages/ts-plugin/e2e-test/invalid-syntax.test.ts: split the shared fixture into 2 behavior-focused tests × 2 variants = 4 tests.
  • packages/ts-plugin/e2e-test/regression/pure-css-file.test.ts: kept as 1 test; switched to setupFixture for consistency.
  • packages/ts-plugin/e2e-test/ignore-generated-files.test.ts: kept as 1 test; replaced the inline diagnostic snapshot with toStrictEqual + dynamically computed ranges. Renamed the test to focus on the actual invariant ("excludes generated .d.ts files from module resolution even when listed in rootDirs") rather than the observable diagnostic.

Note on describe.each for namedExports

The runbook (#378) recommends wrapping every test in describe.each for namedExports. Several files in this PR (refactor, disabled, regression/pure-css-file, ignore-generated-files) skip the wrap because the behaviors under test do not pass through the .d.ts / Volar.js mapping pipeline:

  • refactor only inspects file names
  • disabled short-circuits the entire plugin
  • pure-css-file covers files ts-plugin does not process at all
  • ignore-generated-files exercises file resolution, independent of import shape

Wrapping these would double the test count without exercising additional code paths.

Test plan

  • vp test --project e2e packages/ts-plugin/e2e-test/feature/refactor.test.ts — 4 passed
  • vp test --project e2e packages/ts-plugin/e2e-test/feature/rename-file.test.ts — 6 passed
  • vp test --project e2e packages/ts-plugin/e2e-test/disabled.test.ts — 1 passed
  • vp test --project e2e packages/ts-plugin/e2e-test/invalid-syntax.test.ts — 4 passed
  • vp test --project e2e packages/ts-plugin/e2e-test/regression/pure-css-file.test.ts — 1 passed
  • vp test --project e2e packages/ts-plugin/e2e-test/ignore-generated-files.test.ts — 1 passed
  • vp test --project e2e (full e2e suite) — 127 passed (1 todo)
  • vp check (format + lint + type) — pass

🤖 Generated with Claude Code

mizdra and others added 2 commits May 4, 2026 22:14
…ntax / pure-css-file / ignore-generated-files e2e tests into per-behavior cases

Each test now owns a minimal fixture and asserts a single behavior, completing the
multi-PR series started in #378. Hard-coded line/offset literals are replaced with
getRange / getLoc, and the inline diagnostic snapshot in ignore-generated-files is
replaced with a structural toStrictEqual.

Also adds a missing case to refactor.test.ts: the Create CSS Module file refactor is
suppressed when the paired *.module.css already exists.

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

The previous name described the observable diagnostic; the new name foregrounds
the actual invariant under test: ts-plugin removes generated .d.ts files from
the module resolution path even when their directory is listed in rootDirs.

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 5, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 5, 2026

⚠️ No Changeset found

Latest commit: 7ee9ccd

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

This PR completes the ongoing ts-plugin e2e test refactor series by restructuring the remaining e2e tests so each test owns a minimal fixture and asserts a single behavior. This aligns these files with the newer setupFixture + builder utilities introduced earlier in the series and improves readability and maintainability of the e2e suite.

Changes:

  • Refactors multiple e2e test files to create per-test minimal fixtures via setupFixture, and (where relevant) parameterizes coverage with describe.each for namedExports.
  • Improves assertion clarity by replacing inline snapshots with toStrictEqual and by computing locations/ranges via getLoc/getRange.
  • Adds/clarifies a few missing/negative behavior cases (notably around refactor suppression when the paired CSS module already exists).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/ts-plugin/e2e-test/regression/pure-css-file.test.ts Switches to setupFixture and simplifies diagnostics assertions for non-module .css files.
packages/ts-plugin/e2e-test/invalid-syntax.test.ts Splits invalid CSS syntax coverage into focused tests and runs them for both namedExports variants.
packages/ts-plugin/e2e-test/ignore-generated-files.test.ts Replaces diagnostic snapshot with explicit toStrictEqual using computed ranges; clarifies test intent around rootDirs.
packages/ts-plugin/e2e-test/feature/rename-file.test.ts Splits rename-file behavior into separate tests (TS import, CSS @import, CSS @value ... from) and runs for both namedExports variants.
packages/ts-plugin/e2e-test/feature/refactor.test.ts Splits refactor coverage into separate tests for “applicable refactors” vs “edits for refactor”, adding the “paired module exists” suppression case.
packages/ts-plugin/e2e-test/disabled.test.ts Renames/reframes the disabled-path test and uses setupFixture + getLoc for precise positioning.

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

@mizdra mizdra merged commit 5e44b7f into main May 5, 2026
24 checks passed
@mizdra mizdra deleted the test/e2e-test-misc-pr5 branch May 5, 2026 07: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