Set up component tests with happy-dom and Testing Library
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 67/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 1
- Forks
- 9
- Merge medio
- 10 h 24 min
- PR fusionados (30 d)
- 93
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codercops/toolbelt
-
bug good first issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
bug good first issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 94/100
Los mantenedores suelen responder en 1 día
-
bug good first issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
Los mantenedores suelen responder en 1 día
-
Stop the JSON formatter's Find bar from typing into the JSONPosiblemente ocupada @kudala-bharani la tomó hace 2 días. Abiertobug hacktoberfest help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
codercops/toolbelt#121 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
JSON formatter: a duplicate key crashes the whole toolPosiblemente ocupada @lb1192176991-lab la tomó hoy. Abiertobug good first issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
codercops/toolbelt#218 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de codercops/toolbelt
Issues similares
-
area:editor bug issue-form:bug P0 platform:windows review: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
1lck/Lithe-IDEA#1388 ·
Los mantenedores suelen responder en 1 día
-
fix(api): isToolAuditEnabled swallows database read errors on auditToolOperations without loggingAbiertoarea: backend bug priority: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
snapotter-hq/SnapOtter#3238 ·
Los mantenedores suelen responder en 1 día
-
rig up --plan times out after 5 s and reports an UNKNOWN outcome while the daemon completes the planAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
filesystem: search_files does not expand non-wildcard excludePatterns like directory_tree doesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
modelcontextprotocol/servers#5216 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día