Skip to content

Conversation

@sheremet-va
Copy link
Member

@sheremet-va sheremet-va commented Mar 4, 2025

Description

Migrating away from bundling jest-dom can save us up to 40ms of load time for every test. This can stack very fast depending on the number of tests. We can also reuse PW's locator methods that can already work with accessibility which reduces overall size of the bundle.

In the future, we can also make a breaking change to simplify the expect.element into a simple expect since we now control all matchers:

- await expect.element(locator).toBeVisible()
+ await expect(locator).toBeVisible()

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@netlify
Copy link

netlify bot commented Mar 4, 2025

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 6c18f7b
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/67e3a9c647a53f00082e88eb
😎 Deploy Preview https://deploy-preview-7605--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sheremet-va sheremet-va added the p3-significant High priority enhancement (priority) label Mar 20, 2025
@sheremet-va sheremet-va marked this pull request as ready for review March 21, 2025 13:43
Copy link
Contributor

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

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

Looks good to me! Just have a few questions about testing.

Copy link
Contributor

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

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

Looks good! I didn't check every assertions one by one, but picked some and compared with jest-dom and I got the idea.

I spotted a few left-overs of testing-library/jest-dom in the doc

* [toBeChecked](https://github.com/testing-library/jest-dom#tobechecked) or
* [toHaveFormValues](https://github.com/testing-library/jest-dom#tohaveformvalues).

@sheremet-va
Copy link
Member Author

Looks good! I didn't check every assertions one by one, but picked some and compared with jest-dom and I got the idea.

I spotted a few left-overs of testing-library/jest-dom in the doc

* [toBeChecked](https://github.com/testing-library/jest-dom#tobechecked) or
* [toHaveFormValues](https://github.com/testing-library/jest-dom#tohaveformvalues).

Should be fixed now 👍🏻

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

Labels

p3-significant High priority enhancement (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants