Skip to content

v5.0.2

Choose a tag to compare

@oneadera oneadera released this 16 Jul 10:57
· 17 commits to main since this release

Add Jest + Testing Library infrastructure and a comprehensive test
suite (292 tests, 22 files) covering every exported hook and
function across all three packages.

Infrastructure:

  • Per-package jest.config.cjs + babel.config.cjs, mirroring the
    existing per-package build/typecheck/lint convention
  • web/native tests resolve react-fatless-form to core's source via
    moduleNameMapper, so yarn test never depends on yarn build
  • native mocks react-native (virtual) rather than pulling in the
    full RN/Metro preset, since its src/ never renders real RN
    components
  • Pin react/react-dom to 18.2.0 across root, core, and native
    (devDependencies + scoped resolutions), so react-native's exact
    peer requirement doesn't fragment the install into multiple
    physical React copies

Coverage:

  • core: useForm, handleSubmit, FormProvider/useFormContext,
    createFormContext, useField/createUseField, yupResolver (real yup
    schemas), and the internal get/set/normalizePath path utilities
  • web: all 7 field hooks + useFormSubmit, each tested as a pure
    adaptXField function and as a full DOM round trip
  • native: useTextField, useSwitchField, useNumberField, useFormSubmit

Also fixes useFormSubmit's JSDoc and README examples, which showed
it called from the same component that creates FormProvider - a
pattern that throws ("useFormContext must be used within a
FormProvider") for anyone who copies it. Quick Start now uses
handleSubmit (no context requirement); the API reference documents
the correct FormProvider/child-component split.

Full Changelog: v5.0.0...v5.0.2