Set up component tests with happy-dom and Testing Library
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 67/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 1
- Fork
- 9
- Merge medio
- 10h 24m
- PR unite (30g)
- 93
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di codercops/toolbelt
-
bug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 94/100
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
I maintainer di solito rispondono entro 1 giorno
-
Stop the JSON formatter's Find bar from typing into the JSONForse già presa @kudala-bharani l’ha presa 2 giorni fa. Apertabug hacktoberfest help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
codercops/toolbelt#121 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
JSON formatter: a duplicate key crashes the whole toolForse già presa @lb1192176991-lab l’ha presa 1 giorno fa. Apertabug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
codercops/toolbelt#218 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di codercops/toolbelt
Issue simili
-
ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
xavxyz/bei-shan-lin-shui#57 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] rag: sentence content can cross the reported sentence boundariesForse già presa @LJK-ikun l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
platformatic/mcp#361 ·
I maintainer di solito rispondono entro 1 giorno
-
最近文档这个弹窗,左右宽度没有最小宽度限制Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
siyuan-note/siyuan#20799 · 7 commenti ·
I maintainer di solito rispondono entro 1 giorno