Skip to content

[P0] Migrate Lit browser tests from Web Test Runner to Vitest #44

Description

@Banegasn

Parent: #41. Blocked by #43.

Problem

Five packages run 52 tests through Web Test Runner. The Angular application is moving to Vitest, and maintaining two runners adds duplicated browser provisioning, types, and configuration. The component tests require real browser fidelity for custom elements, Shadow DOM, computed styles, animations, and axe accessibility checks.

Exact target set

  • vitest: 4.1.10.
  • @vitest/browser-playwright: 4.1.10.
  • playwright: 1.61.1.
  • Remove @web/test-runner, @web/test-runner-playwright, @web/dev-server-esbuild, and @types/mocha.
  • Keep @open-wc/testing on the current 3.2.x line during the runner migration so fixture, Chai expect, and to.be.accessible() semantics remain intact. Its 4.0 migration is a separate follow-up, not an accidental omission.

Shared configuration

Create one root Vitest browser configuration that:

  • Uses the Vitest 4 Playwright provider factory and a headless Chromium instance.
  • Uses each package working directory for src/**/*.test.ts discovery.
  • Keeps globals temporarily for source-compatible migration.
  • Fails when a package claiming tests discovers none.
  • Assigns deterministic, collision-free browser API/server ports because Turbo runs five suites concurrently.
  • Supports an installed Chromium/channel override through VITEST_BROWSER_CHANNEL.
  • Produces concise CI output and closes browser resources reliably.

Update the five package scripts to vitest run plus an explicit interactive watch command. Update test tsconfig types to Open WC plus vitest/globals, while keeping tests out of production declarations.

Delete obsolete WTR configs and rename WTR-specific environment plumbing. The root test path must remain noninteractive and deterministic.

Behavioral preservation

  • All 52 assertions must run, not merely compile.
  • Accessibility assertions must still invoke axe through Open WC; do not silently replace Open WC's Chai expect with Vitest's matcher set.
  • Confirm snackbar timer/animation tests are stable under Vitest scheduling.
  • Confirm computed-style token tests execute in Chromium rather than jsdom.

Verification

  • All five suites pass individually in headless Chromium.
  • All five suites pass concurrently through pnpm test without port collisions.
  • to.be.accessible() executes and fails on a deliberate local negative control before that control is reverted.
  • No WTR, WTR launcher, dev-server-esbuild, Mocha types, or obsolete config references remain.
  • Playwright browser installation works in a clean cache and in CI.
  • Test-specific typechecks pass; published declarations remain free of test globals.
  • Frozen install, lint, typecheck, build, production audit, package smoke, license, and clean-diff gates pass.

Merge gate

Merge after #43, then close this issue and unblock the Svelte/Vite dependency train. Close no Dependabot PR until the integrated version is present on main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyReady for autonomous implementationarea: componentsComponent behavior, APIs, or stylingarea: toolingBuild, lint, test, CI, or developer toolingenhancementNew feature or requestpriority: p0Critical foundation or correctness

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions