Set up component tests with happy-dom and Testing Library
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 67/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react, typescript
Hướng nghiên cứu
Start with vitest.config.ts, package.json, and CONTRIBUTING.md; check how lib/ tests are discovered and run. Add component test discovery and a happy-dom environment while keeping lib/ tests in node, then test components/shared/CopyButton.tsx inside ToastProvider from components/shared/Toast.tsx. Done when the test verifies clipboard writing and the “Copied” label, and the requested npm checks pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Tests only cover lib/ today. vitest.config.ts runs everything in the node environment and only picks up lib/**/*.test.ts, and there's no DOM library or Testing Library in package.json. So a fix inside a component can't come with a test that fails before the fix, like the invoice reset fixed in #201 or the theme toggle hydration error in #193.
What to do
- Add
happy-dom,@testing-library/reactand@testing-library/domas dev dependencies (chatcops's widget tests use happy-dom too) - Run component tests in happy-dom and keep the
lib/tests innode, for example with Vitestprojectsor a// @vitest-environment happy-domcomment at the top of each component test - Pick up
*.test.tsxfiles undercomponents/andapp/as well - Write one real test to show it works, for
components/shared/CopyButton.tsx: clicking it callsnavigator.clipboard.writeTextwith its value and the label changes to "Copied". It usesuseToast, so render it insideToastProviderfromcomponents/shared/Toast.tsx. - Add a line next to the one about
lib/__tests__/in CONTRIBUTING.md (line 94) saying where component tests go
Acceptance criteria
-
npm run testruns thelib/tests and the new component test, so CI runs both - The
lib/tests still run innode - The
CopyButtontest fails ifhandleCopystops callingnavigator.clipboard.writeText -
package-lock.jsonis updated withnpm installon Node 22, and only the new packages are added to it -
npm run lint,npm run testandnpm run buildpass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #206 in the description.
- Ngôn ngữ chính
- TypeScript
- Star
- 1
- Fork
- 9
- Merge trung bình
- 8 giờ 8 phút
- Pull request đã merge (30 ngày)
- 155
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codercops/toolbelt
-
Timestamp converter still turns "02/30/2024" into March 1Có thể đã có người làm @bfs2021 đã nhận hôm nay. Đang mởbug good first issue hacktoberfest
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
codercops/toolbelt#345 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Cron explainer says "on weekdays" for `0 0 1-31 * 1-5`, but the next runs include weekendsCó thể đã có người làm @Saifjafri212213 đã nhận 2 ngày trước. Đang mởbug hacktoberfest help wanted
codercops/toolbelt#329 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
UUID generator's v7 batch comes out in random order instead of time orderCó thể đã có người làm @omisha123 đã nhận 2 ngày trước. Đang mởbug good first issue hacktoberfest
codercops/toolbelt#316 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
JSON formatter's "Did you mean" hint reads inside strings, so a missing comma near a URL says to remove commentsCó thể đã có người làm @kachamsiddarth đã nhận 2 ngày trước. Đang mởbug good first issue hacktoberfest
codercops/toolbelt#314 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Base64 decode error points at the wrong character when the input has spaces or line breaksCó thể đã có người làm @Aaqibhafeezkhan đã nhận 2 ngày trước. Đang mởbug good first issue hacktoberfest
codercops/toolbelt#310 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codercops/toolbelt
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
grafana/profiles-drilldown#1212 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
grafana/traces-drilldown#980 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Manager flashes an empty "errorOccurred" dialog while redirecting a logged-out user to loginĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
openremote/openremote#3487 · 1 bình luận ·
-
triage:needs-human
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
garrytan/gbrain#7635 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
coollabsio/jean#867 ·
Maintainer thường phản hồi trong vòng 1 ngày