Skip to content

Migrate test runner to vitest browser #1300

Open
brentswisher wants to merge 7 commits into
developfrom
explore/vite-browser-tests
Open

Migrate test runner to vitest browser #1300
brentswisher wants to merge 7 commits into
developfrom
explore/vite-browser-tests

Conversation

@brentswisher

Copy link
Copy Markdown
Contributor

This change: (check at least one)

  • Adds a new feature
  • Fixes a bug
  • Improves maintainability
  • Improves documentation
  • Is a release activity

Is this a breaking change? (check one)

  • Yes
  • No

Is the: (complete all)

  • Title of this pull request clear, concise, and indicative of the issue number it addresses, if any?
  • Test suite(s) passing?
  • Code coverage maximal?
  • Changeset added?

What does this change address?
Starts the process of migrating away from @open-wc/testing (#1009)

How does this change work?
Our current testing framework has proven to be somewhat hard to work (#580) with and not as well supported (current version) as we would like. While the desired end result is to get rid of @open-wc/testing, doing so all in one pass has proven to be difficult enough that it keeps getting delayed or dropped in favor of more pressing work.

This PR takes things from the other direction - replacing the current wtr test runner with vitest using browser mode, but keeping the tests themselves largely the same. This allows us to start moving in the direction we want to go with minimal changes to the large testing suite we need to maintain.

Once we get this merged in we can start working through the test files component-by-component as we have time and removing @open-wc/testing, we could probably create per-component issues or a project to track that work.

It also has the fringe benefit of making playwright a direct devDependency (closes #1169 ). With wtr, playwright was required but not listed as a dependency. This requiring contributors knowing what was happening and running npx playwright install locally to get tests to pass, which was a frequent stumbling block for new contributors.

@brentswisher brentswisher requested a review from a team as a code owner June 12, 2026 19:11
@brentswisher brentswisher requested review from JimFeather, daneah and jialin-he and removed request for a team June 12, 2026 19:11
@changeset-bot

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: de9d086

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


const silencedLogs = ['Lit is in dev mode.', 'Multiple versions of Lit loaded.'];

// Pre-existing unhandled rejections that wtr ignored, which we can now see and are silencing until resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can add a follow-up issue to address these

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
packages/pharos/lib/index.js 1.05 MB (0%)

);

component.focus();
sendKeys({ press: 'Tab' });

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was never actually doing anything meaningful, I removed just this line on develop as well and the test passes just the same.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These tests passed intermittently as they were when I was running them locally, extending the timeout made them less flaky

?.getAttribute('aria-describedby');

expect(component.renderRoot.querySelector(`#${groupDescID}`)?.textContent)?.to.equal(text);
expect(component.renderRoot.querySelector(`#${groupDescID}`)?.textContent?.trim())?.to.equal(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because of the difference in how vitest compiles the component for testing, there were some whitespace changes, which resulted in errors like this

AssertionError: expected '\n            Please make a selection\n            \n          ' to equal 'Please make a selection'

I just added .trim() where this was happening

headless: true,
provider: playwright(),
screenshotFailures: false,
viewport: { width: 1280, height: 720 },

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Match wtr's full-page size, Vitest iframe default is 414x896

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Getting started guide does not cover playwright installation for running tests

2 participants