Skip to content

Test infra: jsdom environment + .test.tsx support so hooks and components are testable #124

Description

@Rinava

Problem

vitest.config.ts:6-7 sets environment: "node" and include: ["src/**/*.test.ts"]. Two consequences:

  1. Every hook (use-local-storage, use-debounced-value, use-contributors) and component is structurally untestable — no jsdom, no Testing Library.
  2. The .ts-only glob is a trap: a contributor who adds a .test.tsx gets a green run that silently never executed their file.

The pure src/lib logic is well covered (86 tests) — this is specifically about the UI half of the codebase.

Proposed solution

  • Split Vitest into projects (or use environmentMatchGlobs): node for src/lib, jsdom for hooks/components.
  • Add jsdom + @testing-library/react as devDependencies.
  • Broaden the include to src/**/*.test.{ts,tsx}.
  • Land one seed test (e.g. use-debounced-value with fake timers) proving the pipeline.

Acceptance criteria

  • A .test.tsx file actually runs.
  • The seed hook test passes; the existing 86 tests stay green.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions