Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Vitest Browser Mode #11268

Open
maxpatiiuk opened this issue Jan 12, 2025 · 1 comment
Open

Migrate to Vitest Browser Mode #11268

maxpatiiuk opened this issue Jan 12, 2025 · 1 comment
Assignees
Labels
0 - new New issues that need assignment. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. p - medium Issue is non core or affecting less that 60% of people using the library testing Issues related to automated or manual testing.

Comments

@maxpatiiuk
Copy link
Member

maxpatiiuk commented Jan 12, 2025

Priority impact

p - medium

Unstable Tests

Follow up on #11262 (comment)

With migration to Lumina, Calcite switched from Jest to Vitest. However, we are still using Puppeteer.
Vitest browser mode has recently been released as experimental. It offers better developer experience as tests run in the browser (vs puppeteer approach where tests run in node.js and actions are proxied in the dom).
This means tests are able to use the native DOM API and access objects from the browser easily, and synchronously. However, it does mean that a different API needs to be used - given the number of tests Calcite has, this would likely require writing a small codemod.

Benefits of migration:

  • better developer experience
  • tests run in the browser, which is closer to how components are actually used, thus tests are more faithful
  • performance should be faster, since there is no overhead of communication with the browser for each DOM change
  • tests should get more stable. at present, some flakiness occurs because Node.js keeps a copy of the browser DOM, and syncs it with the browser after every change - despite this, it can still get out of date
  • easy access to DOM APIs and dom libraries (in exchange for making access to node.js APIs harder, but not impossible)

Note, while vitest browser mode is gaining features rapidly, it is still marked as experimental. Similarly, Storybook has integration with Vitest browser mode to permit using stories as templates in tests, however, this integration is still in active development for web components. Thus, Calcite team can wait till Vitest browser mode is marked as stable before doing the switch.

@maxpatiiuk maxpatiiuk added testing Issues related to automated or manual testing. 0 - new New issues that need assignment. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. labels Jan 12, 2025
@github-actions github-actions bot added the p - medium Issue is non core or affecting less that 60% of people using the library label Jan 12, 2025
@DitwanP
Copy link
Contributor

DitwanP commented Jan 13, 2025

Revisit milestone assignment after vitest is out of experimental mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - new New issues that need assignment. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. p - medium Issue is non core or affecting less that 60% of people using the library testing Issues related to automated or manual testing.
Projects
None yet
Development

No branches or pull requests

4 participants