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

test: add jest-dom matchers and eslint plugin #2808

Merged

Conversation

kretajak
Copy link
Contributor

Summary

Testing Library provides nice set of custom matchers that are more declarative and easier to understand. Along with @testing-library/jest-dom there is an accompanying eslint-plugin-jest-dom which enforce using these selectors.

Check List

  • pnpm run prettier for formatting code and docs

Copy link

vercel bot commented Nov 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jotai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2024 2:03am

Copy link

codesandbox-ci bot commented Nov 11, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

github-actions bot commented Nov 11, 2024

LiveCodes Preview in LiveCodes

Latest commit: 8dcd74f
Last updated: Nov 13, 2024 2:03am (UTC)

Playground Link
React demo https://livecodes.io?x=id/DBV3UXYNW

See documentations for usage instructions.

@kretajak
Copy link
Contributor Author

Seems like I'm not be able to satisfy TS versions below 4.5.0 as they lacks support of import type. It's similar issue to testing-library/user-event#1161.

@dai-shi
Copy link
Member

dai-shi commented Nov 11, 2024

Can you install an old version for old TS?

pnpm add -D @testing-library/user-event@14.4.3 @types/node@22.2.0

@@ -0,0 +1 @@
import '@testing-library/jest-dom/vitest'
Copy link
Member

Choose a reason for hiding this comment

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

I use the file name vitest-setup.js elsewhere. Maybe vitest-setup.ts here?

https://github.com/jotaijs/jotai-zustand/blob/main/tests/vitest-setup.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh. I was about to change that, but look like PR is merged. :)

Copy link
Member

Choose a reason for hiding this comment

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

I wasn't sure if you were going to change. Feel free to send new PRs.

Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

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

LGTM

@dai-shi dai-shi merged commit 47fef4d into pmndrs:main Nov 13, 2024
40 checks passed
@kretajak kretajak deleted the use-jest-dom-matchers-and-eslint-plugin-jest-dom branch November 13, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants