You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: strengthen test infrastructure and consolidate shared logic (#1427)
* refactor: strengthen test infrastructure and consolidate shared logic
- Add tests/helpers/schemas.ts with common GraphQL schema constants shared
across all five validator spec files (PrimitiveInput, ArrayInput, etc.)
- Add tests/helpers/plugin.ts with a runPlugin() wrapper to reduce
buildSchema + plugin() boilerplate in tests
- Add expectTypeScriptToCompile checks to myzod, valibot, and yup primitive
tests (myzod/valibot had zero compile checks; this adds a baseline)
- Extract src/zod/shared.ts: 22 module-level functions (≈250 lines) that were
100% identical in zod/index.ts and zodv4/index.ts; both files now import from
the shared module (similarity-ts reported 100% match on generateFieldTypeZodSchema
and defaultValueExpression among others)
- Add src/lazy.ts with buildMaybeLazy() — the core isComplex check that drives
lazy-reference wrapping was duplicated across all five validators; each now
passes its own library prefix as a callback
- Add src/scalar.ts with buildScalarSchema() — the scalarSchemas → typeMap →
defaultScalarTypeSchema → fallback pattern was ~84% similar across all five
validators; yup's .defined() wrapping is handled via the wrapCustom option
All 357 tests pass unchanged.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(scalar): guard against null tsType before 'in' operator check
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(scripts): add --ignoreConfig to example type-check scripts for TypeScript 6
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Apply auto lint-fix changes
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments