Skip to content

Conversation

@fabian-hiller
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings January 17, 2026 17:28
@vercel
Copy link

vercel bot commented Jan 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
formisch Ready Ready Preview, Comment Jan 17, 2026 5:29pm

Request Review

@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Jan 17, 2026
@dosubot dosubot bot added the enhancement New feature or request label Jan 17, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive test infrastructure and test suites to the React framework package using Vitest and React Testing Library.

Changes:

  • Adds Vitest configuration with jsdom environment and coverage settings
  • Creates test setup file with Testing Library cleanup configuration
  • Implements test utility helpers (objectPath, arrayPath, validationIssue, schemaIssue) mirroring the core package
  • Adds comprehensive runtime and type tests for all hooks (useForm, useField, useFieldArray, useSignals)
  • Adds comprehensive tests for all components (Form, Field, FieldArray)
  • Updates unit test documentation guide to reflect renamed helper function from issue to validationIssue
  • Adds test-related dependencies (@testing-library/react, @testing-library/jest-dom, vitest, jsdom, @vitest/coverage-v8)

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frameworks/react/vitest.config.ts Configures Vitest with jsdom environment and coverage exclusions
frameworks/react/src/vitest/setup.ts Sets up Testing Library cleanup after each test
frameworks/react/src/vitest/utils.ts Provides test helper utilities for creating validation issues and path items
frameworks/react/src/vitest/index.ts Exports test utilities
frameworks/react/src/hooks/useSignals/useSignals.test.tsx Tests useSignals hook reactivity and cleanup
frameworks/react/src/hooks/useForm/useForm.test.tsx Tests useForm hook initialization, validation, and store stability
frameworks/react/src/hooks/useForm/useForm.test-d.ts Type tests for useForm hook return types and configuration
frameworks/react/src/hooks/useFieldArray/useFieldArray.test.tsx Tests useFieldArray hook state, operations, and reactivity
frameworks/react/src/hooks/useFieldArray/useFieldArray.test-d.ts Type tests for useFieldArray (contains type assertion issues)
frameworks/react/src/hooks/useField/useField.test.tsx Tests useField hook state, props, and event handlers
frameworks/react/src/hooks/useField/useField.test-d.ts Type tests for useField hook types and props
frameworks/react/src/components/Form/Form.test.tsx Tests Form component rendering, submission, and validation
frameworks/react/src/components/FieldArray/FieldArray.test.tsx Tests FieldArray component rendering and array operations
frameworks/react/src/components/Field/Field.test.tsx Tests Field component rendering, state, and event handling
frameworks/react/package.json Adds test script and testing-related dev dependencies
prompts/write-unit-tests.md Updates helper function names to match current implementation
pnpm-lock.yaml Updates lock file with new dependencies
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

const form = useForm({ schema });
const fieldArray = useFieldArray(form, { path: ['items'] });

expectTypeOf(fieldArray.items).toEqualTypeOf<readonly string[]>();
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

Type assertion mismatch: The test expects items to be readonly string[] (an immutable array), but the FieldArrayStore type definition (line 94 in src/types/field.ts) specifies readonly items: string[] (a mutable array). The test should match the actual type definition and use string[] instead of readonly string[].

Copilot uses AI. Check for mistakes.
const form = useForm({ schema });
const fieldArray = useFieldArray(form, { path: ['users'] });

expectTypeOf(fieldArray.items).toEqualTypeOf<readonly string[]>();
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

Type assertion mismatch: The test expects items to be readonly string[] (an immutable array), but the FieldArrayStore type definition (line 94 in src/types/field.ts) specifies readonly items: string[] (a mutable array). The test should match the actual type definition and use string[] instead of readonly string[]. Note that items always contains string IDs regardless of whether the array contains objects or primitives.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants